Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: A finalized program |
| References | <d93ca264-e41a-4f82-8c09-cd87731b2eed@googlegroups.com> <76d2dbff-c516-4e0e-8420-7a7914d7a8f4@googlegroups.com> <87lhcdgm3d.fsf@bsb.me.uk> |
| Message-ID | <SxAIx.423866$vg2.379766@fx34.am4> (permalink) |
| Organization | virginmedia.com |
| Date | 2015-09-11 14:19 +0100 |
On 11/09/2015 13:46, Ben Bacarisse wrote: <snip> > Richard has said don't use scanf, but that's bad advice!! Dem's fitin' woids! I'll see you in the playground at lunchtime. > The correct > advice is don't use scanf for complex things -- it *will* drive you mad. That's certainly true... > But for simple input tasks in beginners' programs it is ideal. ...but that isn't. > He > re-wrote your example using fgets and saying how easy it was. He just > had to write write a dozen or so lines of code to do what %[0-9] does! Yes, but they were easy lines - easy to write, easy to read, easy to understand, and easy to get right. Surely you cannot have overlooked just how much grief scanf has caused just in this one thread? > And he has to use cast, which he hates! Actually, if I hate anything about casts, it is only that they are wrongly used. I could easily have avoided the cast, like this: unsigned char uc = d; if(isdigit(c)) but that would have been pointless. Casts are useful, provided one understands what they are for and when it is appropriate to use them. > What's more, fgets has it's own > problems which can confuse users in interactive programs. Okay, that's worth talking about. What problems are those? > In short, there are loads of interesting things to lean that you will > use time and time again (command-line argument processing is one) but > this isn't one of them! Actually, I'd more or less agree with your main point that interactive programs on the teletype model are rare nowadays, *but* it's still handy to know how to do it, partly because there are times when you just want to hack out a quickie interactive program without going to all the hassle of a full-blown GUI app, but mostly because the skills you learn in doing so are transferable to file processing. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread
A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-08 04:13 -0700
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-08 04:19 -0700
Re: A finalized program fir <profesor.fir@gmail.com> - 2015-09-08 04:30 -0700
Re: A finalized program Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-08 14:45 +0100
Re: A finalized program Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-08 08:29 -0700
Re: A finalized program Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-08 08:52 -0700
Re: A finalized program Martin Shobe <martin.shobe@yahoo.com> - 2015-09-08 13:01 -0500
Re: A finalized program Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-08 21:00 +0100
Re: A finalized program Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-08 13:33 -0700
Re: A finalized program Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-09 00:28 +0100
Re: A finalized program Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-08 14:26 +0100
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-08 06:42 -0700
Re: A finalized program Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-08 20:50 +0100
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 01:47 -0700
Re: A finalized program jt@toerring.de (Jens Thoms Toerring) - 2015-09-08 13:41 +0000
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-10 01:31 -0700
Re: A finalized program jt@toerring.de (Jens Thoms Toerring) - 2015-09-10 10:39 +0000
Re: A finalized program David Thompson <dave.thompson2@verizon.net> - 2015-09-20 18:35 -0400
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-10 01:33 -0700
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-10 10:16 -0700
Re: A finalized program bartekltg <bartekltg@gmail.com> - 2015-09-10 20:08 +0200
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 02:05 -0700
Re: A finalized program Richard Heathfield <rjh@cpax.org.uk> - 2015-09-11 10:17 +0100
Re: A finalized program Richard Heathfield <rjh@cpax.org.uk> - 2015-09-11 10:19 +0100
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 02:28 -0700
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 02:29 -0700
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 02:19 -0700
Re: A finalized program Richard Heathfield <rjh@cpax.org.uk> - 2015-09-11 10:23 +0100
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 02:33 -0700
Re: A finalized program Keith Thompson <kst-u@mib.org> - 2015-09-11 14:11 -0700
Re: A finalized program jt@toerring.de (Jens Thoms Toerring) - 2015-09-11 21:39 +0000
Re: A finalized program bartekltg <bartekltg@gmail.com> - 2015-09-11 12:49 +0200
Re: A finalized program Richard Heathfield <rjh@cpax.org.uk> - 2015-09-10 23:31 +0100
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 02:15 -0700
Re: A finalized program jt@toerring.de (Jens Thoms Toerring) - 2015-09-10 22:37 +0000
Re: A finalized program Richard Heathfield <rjh@cpax.org.uk> - 2015-09-10 23:47 +0100
Re: A finalized program jt@toerring.de (Jens Thoms Toerring) - 2015-09-11 10:18 +0000
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 01:07 -0700
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 02:14 -0700
Re: A finalized program jt@toerring.de (Jens Thoms Toerring) - 2015-09-11 10:10 +0000
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 04:19 -0700
Re: A finalized program Barry Schwarz <schwarzb@dqel.com> - 2015-09-08 15:53 -0700
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 04:27 -0700
Re: A finalized program bartekltg <bartekltg@gmail.com> - 2015-09-11 14:05 +0200
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 04:42 -0700
Re: A finalized program bartekltg <bartekltg@gmail.com> - 2015-09-11 14:15 +0200
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 05:50 -0700
Re: A finalized program bartekltg <bartekltg@gmail.com> - 2015-09-11 15:00 +0200
Re: A finalized program Alla _ <modelling.data@gmail.com> - 2015-09-11 05:50 -0700
Re: A finalized program Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-11 13:46 +0100
Re: A finalized program Richard Heathfield <rjh@cpax.org.uk> - 2015-09-11 14:19 +0100
csiph-web