|
-
Jul 13th, 2004, 11:11 AM
#1
Thread Starter
New Member
Decision making without a huge select case?
I'm trying to figure out if there was a better way to do the following. I'm writting a program that recieves data from a telnet server. It looks at the data and takes actions based on what the data is. The problem is not with the socket connections . The problem is with how to code the decision making.
I was thinking of doing the following. I've got a list of all the known "tokens" (strings that will be recieved from the telnet server). I put the tokens into a string array. I've got a function that takes a string of data from the server and compares it to all the known tokens. If it finds a matching token it returns the index of that token in the string array. Then it passes that number to another function that does the appropriate action for the token. The action taking function is just a big select case.
My question is, is there a better way to do this than with a big select case?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|