Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #98254 > unrolled thread
| Started by | Alla _ <modelling.data@gmail.com> |
|---|---|
| First post | 2016-12-07 05:08 -0800 |
| Last post | 2016-12-10 13:49 -0800 |
| Articles | 20 on this page of 180 — 22 participants |
Back to article view | Back to comp.lang.c
while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-07 05:08 -0800
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-07 13:46 +0000
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-07 07:27 -0800
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-07 16:17 +0000
Re: while loop vs do while loop reading from the file issue Norbert_Paul <norbertpauls_spambin@yahoo.com> - 2016-12-07 14:54 +0100
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-07 07:29 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-07 17:20 +0000
Re: while loop vs do while loop reading from the file issue "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-12-08 01:24 +0800
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-07 22:51 -0800
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-08 07:30 +0000
Re: while loop vs do while loop reading from the file issue Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-12-07 12:45 -0500
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-07 17:50 +0000
Re: while loop vs do while loop reading from the file issue Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-12-07 12:56 -0500
Re: while loop vs do while loop reading from the file issue Barry Schwarz <schwarzb@dqel.com> - 2016-12-07 11:09 -0800
Re: while loop vs do while loop reading from the file issue Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-12-07 14:38 -0500
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-07 23:29 -0800
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-08 07:35 +0000
Re: while loop vs do while loop reading from the file issue Manfred <noname@invalid.add> - 2016-12-08 16:57 +0100
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-10 03:45 -0800
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-09 01:08 -0800
Re: while loop vs do while loop reading from the file issue Barry Schwarz <schwarzb@dqel.com> - 2016-12-09 01:30 -0800
Re: while loop vs do while loop reading from the file issue Barry Schwarz <schwarzb@dqel.com> - 2016-12-09 01:50 -0800
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-10 02:34 -0800
Re: while loop vs do while loop reading from the file issue fir <profesor.fir@gmail.com> - 2016-12-10 03:18 -0800
Re: while loop vs do while loop reading from the file issue Barry Schwarz <schwarzb@dqel.com> - 2016-12-10 07:43 -0800
Re: while loop vs do while loop reading from the file issue Manfred <noname@invalid.add> - 2016-12-10 18:21 +0100
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 10:08 +0000
Re: while loop vs do while loop reading from the file issue Manfred <noname@invalid.add> - 2016-12-09 19:19 +0100
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-10 03:56 -0800
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-10 12:39 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-10 14:58 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-10 16:01 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-10 19:47 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-10 20:16 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-10 21:11 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-10 22:33 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-10 23:50 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-11 00:35 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-10 16:52 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-11 01:34 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-11 02:25 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-11 17:11 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-11 18:00 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-11 19:44 +0000
Re: while loop vs do while loop reading from the file issue supercat@casperkitty.com - 2016-12-11 13:11 -0800
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-11 22:40 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-12 02:03 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-12 12:53 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-12 13:04 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-12 13:27 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-12 15:16 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-12 23:00 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-13 00:59 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-13 03:25 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-13 13:08 +0000
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-13 05:56 -0800
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-13 15:31 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-13 08:27 -0800
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-13 18:07 +0000
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-13 18:12 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-13 18:26 +0000
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-13 18:34 +0000
Re: while loop vs do while loop reading from the file issue Gareth Owen <gwowen@gmail.com> - 2016-12-13 18:39 +0000
Re: while loop vs do while loop reading from the file issue Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-12-13 13:47 -0500
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-13 19:03 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-13 11:30 -0800
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-13 20:10 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-13 12:42 -0800
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-13 21:29 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-13 14:27 -0800
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-13 22:56 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-13 16:13 -0800
Re: while loop vs do while loop reading from the file issue supercat@casperkitty.com - 2016-12-14 07:33 -0800
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-14 09:05 -0800
Re: while loop vs do while loop reading from the file issue supercat@casperkitty.com - 2016-12-13 12:48 -0800
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-13 21:37 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-14 00:08 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-14 01:24 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-13 17:56 -0800
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-14 02:33 +0000
Re: while loop vs do while loop reading from the file issue David Brown <david.brown@hesbynett.no> - 2016-12-14 10:03 +0100
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-14 02:09 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-14 12:24 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-14 13:00 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-14 08:54 -0800
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-14 17:01 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-14 17:27 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-14 20:24 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-15 10:47 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-15 11:54 +0000
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-15 04:02 -0800
Re: while loop vs do while loop reading from the file issue supercat@casperkitty.com - 2016-12-15 07:40 -0800
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-15 11:48 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-16 01:52 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-16 11:09 +0000
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-13 18:35 -0800
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-13 20:18 +0000
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-13 20:14 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-13 20:15 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-13 22:26 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-14 02:19 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-14 12:45 +0000
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-14 14:00 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-14 20:59 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-14 21:59 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-15 02:42 +0000
Re: while loop vs do while loop reading from the file issue asetofsymbols@gmail.com - 2016-12-15 01:20 -0800
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-15 09:28 +0000
Re: while loop vs do while loop reading from the file issue asetofsymbols@gmail.com - 2016-12-15 01:42 -0800
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-15 09:53 +0000
Re: while loop vs do while loop reading from the file issue asetofsymbols@gmail.com - 2016-12-15 01:55 -0800
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-15 02:03 -0800
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-15 10:13 +0000
Re: while loop vs do while loop reading from the file issue Gareth Owen <gwowen@gmail.com> - 2016-12-15 22:05 +0000
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-15 14:15 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-15 10:44 +0000
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-15 03:31 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-16 01:11 +0000
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-16 06:16 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-16 17:24 +0000
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-16 09:53 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-16 20:38 +0000
Re: while loop vs do while loop reading from the file issue Gareth Owen <gwowen@gmail.com> - 2016-12-16 21:13 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-16 21:50 +0000
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-16 14:19 -0800
Re: while loop vs do while loop reading from the file issue supercat@casperkitty.com - 2016-12-16 15:03 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-17 02:20 +0000
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-17 02:21 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-17 12:14 +0000
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-17 04:56 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-17 19:28 +0000
Re: while loop vs do while loop reading from the file issue Ike Naar <ike@iceland.freeshell.org> - 2016-12-17 22:51 +0000
Re: while loop vs do while loop reading from the file issue Les Cargill <lcargill99@comcast.com> - 2016-12-17 11:45 -0600
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-17 19:42 +0000
Re: while loop vs do while loop reading from the file issue Les Cargill <lcargill99@comcast.com> - 2016-12-17 20:39 -0600
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-18 10:49 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-16 09:41 -0800
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-16 10:01 -0800
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-16 12:31 -0800
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-16 13:33 -0800
Re: while loop vs do while loop reading from the file issue Ian Collins <ian-news@hotmail.com> - 2016-12-17 11:12 +1300
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-16 14:30 -0800
Re: while loop vs do while loop reading from the file issue raltbos@xs4all.nl (Richard Bos) - 2016-12-20 11:16 +0000
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-20 03:29 -0800
Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-12 16:13 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-13 01:09 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-10 16:08 -0800
Re: while loop vs do while loop reading from the file issue Sjouke Burry <burrynulnulfour@ppllaanneett.nnll> - 2016-12-11 01:31 +0100
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-11 14:52 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-11 15:26 +0000
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-11 16:22 +0000
Re: while loop vs do while loop reading from the file issue BartC <bc@freeuk.com> - 2016-12-11 16:42 +0000
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-11 16:56 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-11 12:56 -0800
Re: while loop vs do while loop reading from the file issue supercat@casperkitty.com - 2016-12-11 08:55 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-11 17:19 +0000
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-10 04:09 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-10 15:18 +0000
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-10 07:30 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-10 15:43 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-10 14:56 -0800
Re: while loop vs do while loop reading from the file issue Barry Schwarz <schwarzb@dqel.com> - 2016-12-10 07:57 -0800
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-09 11:40 -0800
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-10 03:19 -0800
Re: while loop vs do while loop reading from the file issue Barry Schwarz <schwarzb@dqel.com> - 2016-12-10 07:49 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-10 16:11 +0000
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-10 14:45 -0800
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-10 22:59 +0000
Re: while loop vs do while loop reading from the file issue Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-12-08 11:26 -0500
Re: while loop vs do while loop reading from the file issue Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-12-08 11:48 -0500
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-11 23:33 -0800
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-07 23:09 -0800
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-07 09:53 -0800
Re: while loop vs do while loop reading from the file issue Barry Schwarz <schwarzb@dqel.com> - 2016-12-07 11:26 -0800
Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-07 11:50 -0800
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-07 23:12 -0800
Re: while loop vs do while loop reading from the file issue Richard Heathfield <rjh@cpax.org.uk> - 2016-12-08 07:31 +0000
Re: while loop vs do while loop reading from the file issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-08 11:00 +0000
Re: while loop vs do while loop reading from the file issue Alla _ <modelling.data@gmail.com> - 2016-12-09 00:48 -0800
Re: while loop vs do while loop reading from the file issue Siri Cruise <chine.bleu@yahoo.com> - 2016-12-10 13:49 -0800
Page 8 of 9 — ← Prev page 1 2 3 4 5 6 7 [8] 9 Next page →
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2016-12-17 11:12 +1300 |
| Message-ID | <ebj76hFqh86U2@mid.individual.net> |
| In reply to | #99700 |
On 12/17/16 10:33 AM, Malcolm McLean wrote:
> On Friday, December 16, 2016 at 8:31:27 PM UTC, Keith Thompson wrote:
>> Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
>>> On Friday, December 16, 2016 at 5:41:33 PM UTC, Keith Thompson wrote:
>>>> Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
>>>> [...]
>>>>> Really we want this (pseudo-code)
>>>>>
>>>>> nextline:
>>>>> line = getline();
>>>>> if(line == endofdata)
>>>>> goto endofdata;
>>>>> processline(line);
>>>>> goto nextline;
>>>>> endofdata:
>>>>>
>>>>> but it's not structured.
>>>>
>>>> But it can be written in an equivalent structured form:
>>>>
>>> That's not really possible.
>>>
>>> Structured programming isn't about the notation you use for
>>> the program, but the logical flow. To turn an unstructured
>>> program into an equivalent one that is structured, you need
>>> to rewrite it, not translate it.
>>
>> That's a quibble about the meaning of the word "structured".
>>
>> Whether it's strictly structured or not, I'd say that my equivalent
>> version (which you inexplicably snipped):
>>
>> while ((line = getline()) != endofdata) {
>> processline(line);
>> }
>>
>> is more *nearly* "structured" than yours, and that it's much clearer
>> (at least to someone reasonably familiar with C, and such readers
>> are usually my only target audience for C code).
>>
>> Why exactly did you feel the need to post your version with goto
>> statements? What point were you trying to make?
>>
> A structured program should remain a structured program after
> the compiler translates it to machine code.
Says who?
> The rule is that you can't jump into or out of a block. Each
> block has one point of entry and one point of exit. But you can't
> circumvent the rules by simply splitting a block into two and
> jumping into the line connecting them.
>
> You can however have backwards loops, otherwise you couldn't
> have loops at all.
>
> But I think yours and Ben's code violates some rule. It becomes
> obvious if you ban all control-flow statements except if and
> goto.
Structure is much clearer if you allow all control-flow statements
including if and ban goto...
--
Ian
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.mclean5@btinternet.com> |
|---|---|
| Date | 2016-12-16 14:30 -0800 |
| Message-ID | <37e6daf5-4a6f-47be-9236-dbfbfedf3638@googlegroups.com> |
| In reply to | #99710 |
On Friday, December 16, 2016 at 10:12:41 PM UTC, Ian Collins wrote: > > Structure is much clearer if you allow all control-flow statements > including if and ban goto... > No, because the structure is a characteristic of the control-flow, not the notation.
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2016-12-20 11:16 +0000 |
| Message-ID | <58591225.764390@news.xs4all.nl> |
| In reply to | #99700 |
Malcolm McLean <malcolm.mclean5@btinternet.com> wrote:
> On Friday, December 16, 2016 at 8:31:27 PM UTC, Keith Thompson wrote:
> > Whether it's strictly structured or not, I'd say that my equivalent
> > version (which you inexplicably snipped):
> >
> > while ((line = getline()) != endofdata) {
> > processline(line);
> > }
> >
> > is more *nearly* "structured" than yours, and that it's much clearer
> > (at least to someone reasonably familiar with C, and such readers
> > are usually my only target audience for C code).
> >
> > Why exactly did you feel the need to post your version with goto
> > statements? What point were you trying to make?
> >
> A structured program should remain a structured program after
> the compiler translates it to machine code.
That is a. impossible for most machine languages; b. undesirable anyway,
for reasons of optimisation; and c. simply ludicrous. What a compiler
does with high-level source code has no import on how high-level or
well-written the source code is.
The other way 'round, yes: a badly structured program is bad not only
for human reasons but also because it is often badly optimisable. But a
well structured program can be optimised at least partly because it
allows a compiler to pull all the tricks in the book.
> But I think yours and Ben's code violates some rule.
"Some" rule. More intentionally vague bluster. _Name it_.
Richard
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.mclean5@btinternet.com> |
|---|---|
| Date | 2016-12-20 03:29 -0800 |
| Message-ID | <428e33b4-36db-47f6-95a8-b86e9cba819a@googlegroups.com> |
| In reply to | #99903 |
On Tuesday, December 20, 2016 at 11:17:00 AM UTC, Richard Bos wrote:
> Malcolm McLean <malcolm.mclean5@btinternet.com> wrote:
>
> > On Friday, December 16, 2016 at 8:31:27 PM UTC, Keith Thompson wrote:
>
> > > Whether it's strictly structured or not, I'd say that my equivalent
> > > version (which you inexplicably snipped):
> > >
> > > while ((line = getline()) != endofdata) {
> > > processline(line);
> > > }
> > >
> > > is more *nearly* "structured" than yours, and that it's much clearer
> > > (at least to someone reasonably familiar with C, and such readers
> > > are usually my only target audience for C code).
> > >
> > > Why exactly did you feel the need to post your version with goto
> > > statements? What point were you trying to make?
> > >
> > A structured program should remain a structured program after
> > the compiler translates it to machine code.
>
> That is a. impossible for most machine languages; b. undesirable anyway,
> for reasons of optimisation; and c. simply ludicrous. What a compiler
> does with high-level source code has no import on how high-level or
> well-written the source code is.
> The other way 'round, yes: a badly structured program is bad not only
> for human reasons but also because it is often badly optimisable. But a
> well structured program can be optimised at least partly because it
> allows a compiler to pull all the tricks in the book.
>
> > But I think yours and Ben's code violates some rule.
>
> "Some" rule. More intentionally vague bluster. _Name it_.
>
I don't have a perfect understanding of structured programming,
but it seems to me that by inventing a new primitive Ben is
breaking a property of the original system. In quite a subtle
way. But if you allow two entries into a square block from
square blocks, that breaks the "one entry" condition.
But parroting a rule is of limited value. It's best to try to
fully understand it from first principles.
The "structure" is the structure of the flow. It survives the
translation to machine code, and in fact was designed for
machine code. That said, there are exceptions like trampolines
(when the compiler needs to create an out of-range branch).
But a "block" is ultimately a physical thing. It's a set of
transistors, located together in space, bits set to various
values. The blocks nest, so, they form a tree, with a special
rule for recursion.
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.mclean5@btinternet.com> |
|---|---|
| Date | 2016-12-12 16:13 -0800 |
| Message-ID | <7f9ce24c-3a58-4bd9-8b9c-872c09bccaa7@googlegroups.com> |
| In reply to | #99040 |
On Monday, December 12, 2016 at 1:27:24 PM UTC, Ben Bacarisse wrote:
>
> By why do you need to run it? The discussion is about the structure of
> input loops and there is only one of those:
>
> while (fgets(line, sizeof line, fp)) ...
>
I'd change to this
char *line = 0;
int N = 0; // We never actually read this
int err;
while( (err = fgetstring(&line, &N, fp)) == 0)
{
processline(line);
}
if(err != EOF)
{
/* something nasty happened, maybe we ran out of memory
or the disk drive had its usb pulled out. err will
tell us roughly what it was, and we have rich set of
error querying functions for high-end user
troubleshooting. */
}
/* don't forget */
free(line);
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-12-13 01:09 +0000 |
| Message-ID | <87twa8ocrn.fsf@bsb.me.uk> |
| In reply to | #99155 |
Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
> On Monday, December 12, 2016 at 1:27:24 PM UTC, Ben Bacarisse wrote:
>>
>> By why do you need to run it? The discussion is about the structure of
>> input loops and there is only one of those:
>>
>> while (fgets(line, sizeof line, fp)) ...
>>
>
> I'd change to this
>
> char *line = 0;
> int N = 0; // We never actually read this
> int err;
>
> while( (err = fgetstring(&line, &N, fp)) == 0)
> {
> processline(line);
> }
> if(err != EOF)
> {
> /* something nasty happened, maybe we ran out of memory
> or the disk drive had its usb pulled out. err will
> tell us roughly what it was, and we have rich set of
> error querying functions for high-end user
> troubleshooting. */
> }
> /* don't forget */
> free(line);
A good plan, though maybe a bit over-engineered when the specification
gave a maximum line length. (I'd probably call the function fgetline to
indicate its line-oriented nature, but that's a detail.)
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2016-12-10 16:08 -0800 |
| Message-ID | <lnwpf7uy2m.fsf@kst-u.example.com> |
| In reply to | #98742 |
BartC <bc@freeuk.com> writes:
> On 10/12/2016 21:11, Ben Bacarisse wrote:
[...]
>> (Have you got an example of a loop that's simpler with pre-EOF testing
>> yet? I don't want that interesting point to slip away.)
>
> This is just going to be your opinion versus mine. Last time this was
> discussed, you favoured putting as much as possible into a while
> condition; I preferred keeping the conditional minimal, except in the
> simplest case (reading a character at a time).
>
> To me, divorcing the eof check and the main loop terminating logic from
> the actual processing that is done, is a benefit:
>
> while (!eof(f)) {
> read stuff...
> }
I think that's to general to be a useful example.
> I can see at a glance that this is probably iterating over a file. I can
> see that it will definitely end as soon eof() returns true.
>
> It's just an idiom I use a lot (in fact I could go through a pile of
> code looking for such while loops, in a way I couldn't do if the loop
> condition was always different).
As I recall, your eof() function attempts to read a character, and the
pushes it back with ungetc() if it was able to do so. I haven't tried
it, but I believe it would cause problems with interactive input. I
remember that being a serious problem with Pascal's input handling.
If you don't like putting complex expressions into a while condition, as
in the common C idiom:
int c;
while ((c = getchar()) != EOF) {
/* do something with c */
}
then you can separate it:
while (1) {
int c = getchar();
if (c == EOF) break;
/* do something with c */
}
It's less than ideal in that the condition that terinates the loop is in
the body of the loop rather than at the top (which is why I prefer the
usual idiom).
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Sjouke Burry <burrynulnulfour@ppllaanneett.nnll> |
|---|---|
| Date | 2016-12-11 01:31 +0100 |
| Message-ID | <584c9e53$0$2209$e4fe514c@textnews.kpn.nl> |
| In reply to | #98730 |
On 10.12.16 21:16, BartC wrote:
> On 10/12/2016 19:47, Ben Bacarisse wrote:
>> BartC <bc@freeuk.com> writes:
>
>>> If you pause halfway through reading one file (say it's ASCII art),
>>> run another program which updates it (with a chapter from a novel),
>>> then continue with the first program, it will now be reading
>>> nonsense.
>>
>> Right. And the same thing can happen if the program is presented with
>> junk data to start with. In what way is "input that changes" different
>> to "input"? In one case you read, verify and process, but in the other
>> "you might as well give up"? I don't see it. You just read, verify and
>> process in all cases.
>
> It's not the same at all. How would you verify my example of an ASCII
> art file? Or a text file containing a story? Or a C source file which
> still compiles but the earlier content is now somewhat different?
>
> There is a limit to what can be verified with the error codes from a
> file read function.
>
> Suppose you're verifying that a file consists entirely of letter 'A's.
> The simplest method is to read a character at a time and check that is
> is 'A'. But how do you know that since you've been reading it, another
> process has changed a previously read 'A' to a 'B'?
>
> If you allow that a file being read is continually changing, then you
> can't really do anything, even if you managed to detect such a change.
>
XXXX
X XX
X *** X XXXXX
X ***** X XXX XX
XXXX ******* XXX XXXX XX
XX X ****** XXXXXXXXX XX XXX
XX X **** X X** X
X XX XX X X***X
X //XXXX X XXXX
X // X XX
X // X XXXXXXXXXXXXXXXXXX/
X XXX// X X
X X X X X
X X X X X
X X X X X XX
X X X X X XXX XX
X XXX X X X X X X
X X X XX X XXXX
X X XXXXXXXX\ XX XX X
XX XX X X X XX
XX XXXX XXXXXX/ X XXXX
XXX XX*** X X
XXXXXXXXXXXXX * * X X
*---* X X X
*-* * XXX X X
*- * XXX X
*- *X XXX
*- *X X XXX
*- *X X XX
*- *XX X X
* *X* X X X
* *X * X X X
* * X** X XXXX X
* * X** XX X X
* ** X** X XX X
* ** X* XXX X X
* ** XX XXXX XXX
* * * XXXX X X
* * * X X X
=======******* * * X X XXXXXXXX\
* * * /XXXXX XXXXXXXX\ )
=====********** * X ) \ )
====* * X \ \ )XXXXX
=========********** XXXXXXXXXXXXXXXXXXXXXX
C
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2016-12-11 14:52 +0000 |
| Message-ID | <o2jp4d$ffe$2@dont-email.me> |
| In reply to | #98682 |
On 10/12/16 12:39, BartC wrote: <snip> > > An eof check at the start of a loop I think is a good way of reading > files You are mistaken. -- 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
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2016-12-11 15:26 +0000 |
| Message-ID | <o2jr4i$nao$1@dont-email.me> |
| In reply to | #98805 |
On 11/12/2016 14:52, Richard Heathfield wrote: > On 10/12/16 12:39, BartC wrote: > <snip> >> >> An eof check at the start of a loop I think is a good way of reading >> files > > You are mistaken. How do you back your car up into a space: do you keep checking there's still room then reverse a bit more, or do you just keep reversing until you hear a crunch? If you had to fill a series of glasses, would you check there's at least one more empty glass then fill that, or would you keep going until you're pouring liquid all over the table and then stop? That's the difference between the two methods. I prefer to be a bit more careful. And tidy. -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2016-12-11 16:22 +0000 |
| Message-ID | <o2judn$a99$3@dont-email.me> |
| In reply to | #98813 |
On 11/12/16 15:26, BartC wrote: > On 11/12/2016 14:52, Richard Heathfield wrote: >> On 10/12/16 12:39, BartC wrote: >> <snip> >>> >>> An eof check at the start of a loop I think is a good way of reading >>> files >> >> You are mistaken. > > How do you back your car up into a space: Do you really think that reading data from a stream is isomorphic to reversing your car? > If you had to fill a series of glasses, would you check there's at least > one more empty glass then fill that, or would you keep going until > you're pouring liquid all over the table and then stop? Do you really think that reading data from a stream is isomorphic to filling a series of glasses? -- 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
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2016-12-11 16:42 +0000 |
| Message-ID | <o2jvie$uvi$1@dont-email.me> |
| In reply to | #98827 |
On 11/12/2016 16:22, Richard Heathfield wrote: > On 11/12/16 15:26, BartC wrote: >> On 11/12/2016 14:52, Richard Heathfield wrote: >>> On 10/12/16 12:39, BartC wrote: >>> <snip> >>>> >>>> An eof check at the start of a loop I think is a good way of reading >>>> files >>> >>> You are mistaken. >> >> How do you back your car up into a space: > > Do you really think that reading data from a stream is isomorphic to > reversing your car? > >> If you had to fill a series of glasses, would you check there's at least >> one more empty glass then fill that, or would you keep going until >> you're pouring liquid all over the table and then stop? > > Do you really think that reading data from a stream is isomorphic to > filling a series of glasses? So what /is/ it like then? You blindly keep on doing something until it breaks and using that to tell you've finished (and it's time to pick up the pieces). Sometimes there is no choice, but here there is. -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2016-12-11 16:56 +0000 |
| Message-ID | <o2k0dt$6dm$1@dont-email.me> |
| In reply to | #98831 |
On 11/12/16 16:42, BartC wrote: > On 11/12/2016 16:22, Richard Heathfield wrote: >> On 11/12/16 15:26, BartC wrote: >>> On 11/12/2016 14:52, Richard Heathfield wrote: >>>> On 10/12/16 12:39, BartC wrote: >>>> <snip> >>>>> >>>>> An eof check at the start of a loop I think is a good way of reading >>>>> files >>>> >>>> You are mistaken. >>> >>> How do you back your car up into a space: >> >> Do you really think that reading data from a stream is isomorphic to >> reversing your car? >> >>> If you had to fill a series of glasses, would you check there's at least >>> one more empty glass then fill that, or would you keep going until >>> you're pouring liquid all over the table and then stop? >> >> Do you really think that reading data from a stream is isomorphic to >> filling a series of glasses? > > So what /is/ it like then? It's rather like reading data from an input stream. You ask the OS to give you some data from the stream. It either complies or explains why it can't. If you got some data, you process the data and then go round again. > You blindly keep on doing something until it > breaks and using that to tell you've finished (and it's time to pick up > the pieces). No pieces to pick up. That's the whole point. > Sometimes there is no choice, but here there is. The choice seems to be between an ugly way of doing things with no payoff to offset the ugliness, or an elegant way of doing things with no downside. I'll take the elegant way, every time. -- 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
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2016-12-11 12:56 -0800 |
| Message-ID | <ln4m2atcb9.fsf@kst-u.example.com> |
| In reply to | #98831 |
BartC <bc@freeuk.com> writes:
> On 11/12/2016 16:22, Richard Heathfield wrote:
[...]
>> Do you really think that reading data from a stream is isomorphic to
>> filling a series of glasses?
>
> So what /is/ it like then? You blindly keep on doing something until it
> breaks and using that to tell you've finished (and it's time to pick up
> the pieces).
Yes.
That's not as sensible solution if you're backing up a car or filling a
series of glasses, because in those contexts a failure in one step can
have harmful side effects.
An input function that fails because there's no more data to read will
report failure *without* doing any further damage. It is therefore
sensible to attempt to read input and then check whether the attempt
succeeded.
> Sometimes there is no choice, but here there is.
Sure, there's a choice. Checking for end-of-file at the top of the
loop, given the way C's input functions are designed, is not the best
one.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | supercat@casperkitty.com |
|---|---|
| Date | 2016-12-11 08:55 -0800 |
| Message-ID | <dae9fec4-c793-4eab-bf64-eec80e201732@googlegroups.com> |
| In reply to | #98813 |
On Sunday, December 11, 2016 at 9:26:35 AM UTC-6, Bart wrote: > How do you back your car up into a space: do you keep checking there's > still room then reverse a bit more, or do you just keep reversing until > you hear a crunch? If you are trying to back your car's wheels against a low curb, the latter approach might be the only practical one (going until resistance is felt, though, rather than listening for a crunch). Designing a curb such that it can be used in such fashion without damage to itself or the vehicle may be easier than trying to design the vehicle and curb with adequate visibility to allow a driver to judge the curb's position before contact. Some kinds of file system would be able to let a program know in advance whether any particular kind of read would succeed, some might offer indications whether a read is likely to succeed or likely to fail, and some might not offer anything other than "try and see". If a system does not provide anything except the latter, code may have no alternative but to use that approach.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-12-11 17:19 +0000 |
| Message-ID | <8737huxu2b.fsf@bsb.me.uk> |
| In reply to | #98813 |
BartC <bc@freeuk.com> writes: > On 11/12/2016 14:52, Richard Heathfield wrote: >> On 10/12/16 12:39, BartC wrote: >> <snip> >>> >>> An eof check at the start of a loop I think is a good way of reading >>> files >> >> You are mistaken. > > How do you back your car up into a space: do you keep checking there's > still room then reverse a bit more, or do you just keep reversing > until you hear a crunch? How do you eat the toffees in your pocket? Do you keep taking your jacket off to have look to make sure there is one left before putting you hand in to get it, or do you just try and only stop when your hand signals there are aren't any left? Analogies work only explain. You won't switch to C's way of doing I/O because I give you an analogy, and I won't start writing bad C input loops because you suggest the other way is analogous to crashing my car. <snip> -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Alla _ <modelling.data@gmail.com> |
|---|---|
| Date | 2016-12-10 04:09 -0800 |
| Message-ID | <5645192c-a548-4402-bdfb-506ecd74ee49@googlegroups.com> |
| In reply to | #98472 |
On Friday, December 9, 2016 at 1:08:32 PM UTC+3, Richard Heathfield wrote:
> On 09/12/16 09:08, Alla _ wrote:
> > On Thursday, December 8, 2016 at 10:35:42 AM UTC+3, Richard Heathfield wrote:
> >> On 08/12/16 07:29, Alla _ wrote:
> >>> On Wednesday, December 7, 2016 at 10:38:21 PM UTC+3, Lew Pitcher wrote:
> >>>> On Wednesday December 7 2016 14:09, in comp.lang.c, "Barry Schwarz"
> >>>> <schwarzb@dqel.com> wrote:
> >>>>
> >>>>> On Wed, 07 Dec 2016 12:56:08 -0500, Lew Pitcher
> >>>>> <lew.pitcher@digitalfreehold.ca> wrote:
> >>>>>
> >>>>>> On Wednesday December 7 2016 12:50, in comp.lang.c, "Richard Heathfield"
> >>>>>> <rjh@cpax.org.uk> wrote:
> >>>>>>
> >>>>>>> On 07/12/16 17:45, Lew Pitcher wrote:
> >>>>>>>
> >>>>>>> <snip>
> >>>>>>>
> >>>>>>>> Like Richard, I get an infinite loop of ill-formed data.
> >>>>>>>
> >>>>>>> This is almost certainly because the code was not, despite Alla's claim,
> >>>>>>> written to handle CSV files. There is no CSV-parsing logic whatsoever in
> >>>>>>> either her program or the original.
> >>>>>>>
> > <snip>
> >> Well, you /said/ it was /already/ in csv format, so why would you need
> >> to convert it? But if it's already in csv format, why doesn't your
> >> program cope with csv files, and why do you obviously think it /does/
> >> cope with them?
> >>
> >> More 'why' questions, I see. Sorry about that.
> >
> > I am totally fine with 'why's - they are very helpful and provocative;
> > some sort of a socratic method )
>
> That's good, but you do need to take note of the questions and to learn
> from them.
>
> > Based on your questions and questions posted by Lew in his helpful answer (below),
> > I have understood that I did not make myself 100% clear about the versions I posted here.
> > I did hope that my initial explanations are suffice.
>
> It seems not.
>
> > To make things clear, and to do so, let's forget about the 'do-while' loop story for now
> > (it's solved anyway):
>
> I hope the solution you arrived at was that the do-while loop was a bad
> idea in this case. That doesn't mean it's always a bad idea, but for an
> input loop a simple while is better.
>
> > 1) The program I have posted is from D&D; hence all fscanf, and other functions, and their
> > formats are not my invention.
>
> All right. It's not how I would do it, but yes, it can be done that way.
>
> > 2) This particular program is the second one in the chain of file i/o programs.
> > 3) Therefore the program before it was the one that has created that csv file.
>
> There wasn't really a CSV file, was there?
>
> > See below under I.
>
> Please understand that C has no magical way of knowing what format your
> file is in. It doesn't care about file extensions. It only cares about
> the bytes in the file. The most you can hope for is a little minor magic
> with text-oriented streams, whereby the C runtime can convert Windows
> \r\n sequences into \n on the way in, and convert \n back to \r\n on the
> way out again. Anything more than that, you have to do for yourself.
> Calling a file ".csv" doesn't make it a CSV (comma-separated values)
> file. What makes it a CSV file is the separation of values by commas.
> But if you /do/ call it a ".csv" file, you can perhaps understand why
> people assume you are talking about a comma-separated values file.
>
> > 4) The only thing I have changed in the original program is, indeed, the file extension:
> > I have used .csv, while D&D use .dat.
>
> That's fine, albeit misleading. C doesn't care either way. But your
> readers may well be fooled into thinking you had a comma-separated
> values file as your input. Since you didn't actually post your input
> file, how were we to know?
>
> > 5) I did manage to get the result I have posted in my original message: the file was created
> > with the content I showed and then this content has been read successfully (I am again referring
> > to the note I wrote before this explanation - nothing to do with the do-while topic).
> >
> > Now I wonder does it mean that the file format change has caused the gibberish that
> > you get when running the program?
>
> Because you didn't post your data file, we had to construct our own.
> Because you said ".csv", we used a CSV format. That wasn't the format
> your program had been written to expect. And so, when your program read
> our files (mine and Lew Pitcher's), it couldn't make sense of them. Why
> should it? Our data were separated by commas, whereas your data were
> constructed in a different way.
>
> > I have now tried another program, which has almost
> > same steps (see below under II) and it indeed writes a nonsensical data into the created csv file.
>
> Then let's try to find out why.
>
> > Note: the style of commenting is not mine either
> >
> > ( I ) two original programs: one creates a file, another reads from that file.
> >
> > // Fig. 11.2: fig11_02.c
> > // Creating a sequential file
> >
> > #include <stdio.h>
> >
> > int main( void )
> > {
> > unsigned int account; // account number
> > char name[ 30 ]; // account name
> > double balance; // account balance
> >
> > FILE *cfPtr; // cfPtr = clients.csv file pointer
> >
> > // fopen opens file. Exit program if unable to create file
> > if ( (cfPtr = fopen( "clients.csv", "w")) == NULL )
> > {
> > puts( "File could not be opened" );
> > } // end if
> > else
> > {
> > puts( "Enter the account, name, and balance." );
> > puts( "Enter EOF to end input." );
> > printf( "%s", "? " );
> > scanf( "%d%29s%lf", &account, name, &balance );
>
> What if this call fails? How would you know? You haven't checked the
> return value. And why are you using %d for an unsigned int?
>
> > // write account, name and balance into file with fprintf
> > while ( !feof( stdin ) )
>
> Correct me if I'm wrong, but haven't you already been told that feof is
> a lousy way to control an input loop?
>
> Is this Deitel & Deitel telling you to do it like this? If so, they just
> went down in my estimation.
>
> Here is how you do it:
>
> while(data-reading function got some data)
> {
> process that data
> }
>
> For example, to echo the input but insert a '#' at the start of every line:
>
> while(fgets(line, sizeof line, stdin) != NULL)
> {
> printf("#%s", line);
> }
>
> No feof() call in that loop! The point of feof() is that you can call it
> /after/ the loop, to find out whether you processed all the data.
>
> if(feof(stdin))
> {
> you got everything, so it's probably fine
> }
> else
> {
> maybe something went wrong
> if(ferror(stdin))
> {
> something DID go wrong!
> }
> }
>
>
> > {
> > fprintf( cfPtr, "%d %s %.2f\n", account, name, balance );
>
> (Why are you using %d to print an unsigned int?)
>
> Note that this line does *not* write CSV data. Now, nobody's saying you
> /have/ to write CSV data, but if you do want to write CSV data this
> isn't the way to do it. Instead, you would write:
>
> fprintf( cfPtr, "%d,%s,%.2f\n", account, name, balance );
>
> Do you see the difference?
Definitely ) After all these discussions, as I have noted elsewhere, I have
a much better understanding - now that you all have explained my mistakes,
I look at this thinking how could I miss such obvious matter? Yeh, we are all
smart with hindsight )
>
> Now, given that your second program doesn't know how to read CSV data,
> you don't actually want your first program to write CSV data. Rather,
> you want your first program to write the data in a way that the second
> program understands. And this you do appear to have done. The problem
> arose because, right at the start, you introduced this CSV red herring
> into the discussion.
>
> > And the result in csv file is:
>
> But it's not a CSV file, is it? Not really.
>
> > BrownNancyHáz ®‡8À%BarkerDoug
>
> Okay. Look at the data. First, I note that the leading account number is
> not present. Did your file-creating program check that it had a valid
> account number? Second, the strange characters suggest either that you
> have exceeded the bounds of an array used for storing a string or that
> you have attempted to interpret some other data type as if it were a
> pointer to the first character of a string.
>
Interesting. As you can see from the tiny input data I suggested,
I have not either exceeded the bounds of an array, nor have I missed
to input the account number. One more time - these two programs
are from the book, written word for word; and the authors claim these
should do the job. I don't see why they don't, if to leave behind the
whole csv mess I have caused - now I know, and anyway I need
to rewrite these programs to be able to read/write csv because
I will use it in my program later on.
> --
> 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
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-12-10 15:18 +0000 |
| Message-ID | <87k2b73j98.fsf@bsb.me.uk> |
| In reply to | #98680 |
Alla _ <modelling.data@gmail.com> writes: <snip> > Interesting. As you can see from the tiny input data I suggested, > I have not either exceeded the bounds of an array, nor have I missed > to input the account number. One more time - these two programs > are from the book, written word for word; and the authors claim these > should do the job. I don't see why they don't, I, for one, have got confused. I'm sure the two programs are "up there" somewhere but can you post them again, along with whatever it is that is puzzling you about them (presumably some bad output of mystery input). It may be best in a new thread... <snip> -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Alla _ <modelling.data@gmail.com> |
|---|---|
| Date | 2016-12-10 07:30 -0800 |
| Message-ID | <4f8041a7-c5c6-4715-b9b8-e5ff964f6c3c@googlegroups.com> |
| In reply to | #98696 |
On Saturday, December 10, 2016 at 6:18:33 PM UTC+3, Ben Bacarisse wrote: > Alla _ <modelling.data@gmail.com> writes: > <snip> > > Interesting. As you can see from the tiny input data I suggested, > > I have not either exceeded the bounds of an array, nor have I missed > > to input the account number. One more time - these two programs > > are from the book, written word for word; and the authors claim these > > should do the job. I don't see why they don't, > > I, for one, have got confused. I'm sure the two programs are "up there" > somewhere but can you post them again, along with whatever it is that is > puzzling you about them (presumably some bad output of mystery input). > > It may be best in a new thread... > Of course. I will first re-write both in a way they are able to read from and write to csv files, and then I post original ones and my versions in a new thread. Offtopic: I am not sure I am doing snipping correctly: I simply delete whatever is not related to a particular answer, and put <snip>; but I have no idea how everyone here are able to snip things in such a way that I see a phrase "show quoted text". Please, don't laugh at me, I understand that this an extremely silly question, but I truly have no idea, and, honestly, this time I didn't consult any search engine before asking. Sorry ) > <snip> > -- > Ben.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-12-10 15:43 +0000 |
| Message-ID | <87eg1f3i3b.fsf@bsb.me.uk> |
| In reply to | #98699 |
Alla _ <modelling.data@gmail.com> writes: > On Saturday, December 10, 2016 at 6:18:33 PM UTC+3, Ben Bacarisse wrote: >> Alla _ <modelling.data@gmail.com> writes: >> <snip> >> > Interesting. As you can see from the tiny input data I suggested, >> > I have not either exceeded the bounds of an array, nor have I missed >> > to input the account number. One more time - these two programs >> > are from the book, written word for word; and the authors claim these >> > should do the job. I don't see why they don't, >> >> I, for one, have got confused. I'm sure the two programs are "up there" >> somewhere but can you post them again, along with whatever it is that is >> puzzling you about them (presumably some bad output of mystery input). >> >> It may be best in a new thread... >> > Of course. I will first re-write both in a way they are able to read from and > write to csv files, and then I post original ones and my versions in a new > thread. Personally, I would only post the originals since you think there is a problem with them. Having multiple programs in the same post is always problematic. > Offtopic: > I am not sure I am doing snipping correctly: I simply delete whatever is not > related to a particular answer, and put <snip>; What you are doing is exactly right (at least in my opinion). > but I have no idea how everyone > here are able to snip things in such a way that I see a phrase "show > quoted text". Does that not appear when you look at your posts? I don't see that text because I use a different news reader, but your posts and my posts look essentially the same to me. <snip> -- Ben.
[toc] | [prev] | [next] | [standalone]
Page 8 of 9 — ← Prev page 1 2 3 4 5 6 7 [8] 9 Next page →
Back to top | Article view | comp.lang.c
csiph-web