Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ben Bacarisse <ben.lists@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: can this be done recursively |
| Date | 2015-04-22 20:57 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87egnc9brp.fsf@bsb.me.uk> (permalink) |
| References | <b0319922-1b5e-48d2-8cc7-5cd1a5e866e6@googlegroups.com> <e07362d0-5d7e-4243-acc6-bcf384298b69@googlegroups.com> |
G G <gdotone@gmail.com> writes: > I have another question: i'm using os x 10.3.3, and when i do a control-D > the program does not quit. it enters an infinite loop, well, a loop, it seems > as if it is infinite, of course i stop it, using Xcode stop execution button. > > shouldn't control-D or control-z halt the execution of the program no matter > what's being read in? All control-D does is to close the input stream so that the next input operation will fail (getchar and scanf will return EOF for example). It's up to you to spot that and stop your program. If you look at your code, you'll see that it never looks for this sort of result. There's also a technicality: ch should be declared to be int not char. EOF is a negative integer value guaranteed to be different from any actualy character value that getchar can legitimately return. You should therefore always put the result into an int rather than a char variable. <snip> -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
can this be done recursively G G <gdotone@gmail.com> - 2015-04-19 09:50 -0700
Re: can this be done recursively Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-04-19 21:14 +0100
Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-19 14:20 -0700
Re: can this be done recursively Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-04-19 16:32 -0400
Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-19 14:25 -0700
Re: can this be done recursively Keith Thompson <kst-u@mib.org> - 2015-04-19 14:09 -0700
Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-19 14:35 -0700
Re: can this be done recursively jt@toerring.de (Jens Thoms Toerring) - 2015-04-19 22:57 +0000
Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-20 04:30 -0700
Re: can this be done recursively Richard Heathfield <rjh@cpax.org.uk> - 2015-04-20 12:49 +0100
Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-20 05:28 -0700
Re: can this be done recursively jt@toerring.de (Jens Thoms Toerring) - 2015-04-20 13:09 +0000
Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-22 09:42 -0700
Re: can this be done recursively Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-04-22 10:12 -0700
Re: can this be done recursively James Kuyper <jameskuyper@verizon.net> - 2015-04-22 13:29 -0400
Re: can this be done recursively Ben Bacarisse <ben.lists@bsb.me.uk> - 2015-04-22 20:57 +0100
Re: can this be done recursively James Kuyper <jameskuyper@verizon.net> - 2015-04-22 16:12 -0400
Re: can this be done recursively Ben Bacarisse <ben.lists@bsb.me.uk> - 2015-04-22 23:14 +0100
Re: can this be done recursively James Kuyper <jameskuyper@verizon.net> - 2015-04-22 18:56 -0400
Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-23 07:59 -0700
csiph-web