On Mon, Feb 11, 2002 at 12:17:47AM -0500, Bejhan Jetha wrote:
>I know C doesn't support multiple case values but is there another way to
>make it so you can still have two letters without using case values?
I take it from the followups you're trying to parse a direction?
1: No, switch/case wants a single value and will let you know about it
if you try to compile with "NE".
2: What's wrong with doing a couple search_block()'s, setting a
varaible, and then doing whatever based on the variable (including
switch) ?
(mailer code)
int find_dir(char *arg)
{
int retval = -1;
if(retval=search_block(arg, dirs) >= 0);
else if(retval = search_block(arg, abbr_dirs) >= 0);
return retval;
}
then just somewhere do:
void somefunc(char *dir)
{
dir = find_dir(dir);
switch(dir) {
case 0:
whatever
case 1:
whatever..
.
.
.
case -1:
That's not a direction.
}
}
--
Under the DMCA, I'm allowed to use my computer and the internet to
design, discuss, and improve a thermonuclear weapon, but I can't
use it to watch a DVD while running Linux.
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT