Re: Is getopt() standard C? etc.
From: Runtime (spam_at_heliopause.nu)
Date: 01/30/04
- Next message: Christopher Benson-Manica: "Re: [OT] Shooting yourself in the foot"
- Previous message: Joona I Palaste: "Re: Is getopt() standard C? etc."
- In reply to: José de Paula: "Is getopt() standard C? etc."
- Next in thread: nrk: "Re: Is getopt() standard C? etc."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 30 Jan 2004 14:44:27 -0000
In other news, José de Paula <jose_de_paula@ig.com.br> typed:
> Another doubt: I have a switch inside a while loop; is there a way to
> break out of the loop from the switch without using goto? I mean:
>
I'd do:
> while(chr = fgetc(inputfile))
> {
int should_break_out = 0;
> switch(chr)
> {
> case 'a': case 'b':
> do_one_stuff(chr);
> break;
> case 'c': case 'd':
> do_some_other_stuff(chr);
> break;
> case 'e': case 'f':
> do_stuff(chr);
> break;
> default:
should_break_out = 1;
break;
> } /* end switch */
if( should_break_out )
break;
> do_even_more_stuff_here();
> } /* end while */
>
> Is there a way to get out of the while (i.e., skipping the
> "do_even_more_stuff_here();" part) without using this goto?
>
-- runtime
- Next message: Christopher Benson-Manica: "Re: [OT] Shooting yourself in the foot"
- Previous message: Joona I Palaste: "Re: Is getopt() standard C? etc."
- In reply to: José de Paula: "Is getopt() standard C? etc."
- Next in thread: nrk: "Re: Is getopt() standard C? etc."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|