Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #98254 > unrolled thread

while loop vs do while loop reading from the file issue

Started byAlla _ <modelling.data@gmail.com>
First post2016-12-07 05:08 -0800
Last post2016-12-10 13:49 -0800
Articles 20 on this page of 180 — 22 participants

Back to article view | Back to comp.lang.c


Contents

  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 9 of 9 — ← Prev page 1 2 3 4 5 6 7 8 [9]


#98744

FromKeith Thompson <kst-u@mib.org>
Date2016-12-10 14:56 -0800
Message-ID<ln1sxfwfyx.fsf@kst-u.example.com>
In reply to#98699
Alla _ <modelling.data@gmail.com> writes:
[...]
> 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 )

I you're seeing "show quoted text", it's being displayed by your
newsreader; it's not part of the article.  I think you're using the
Google Groups web interface.  I don't use it much myself, but it
*probably* detects blocks of quoted text and gives you the option to see
them or not.

Perhaps there's some specific syntax that GG depends on.

Your own articles seem to do quoting and attribution correctly.  My only
quibble is that you often leave too much quoted text in place.  That's
probably better than not leaving enough, but many newsreaders simply
display the entire article, including any quoted text.  I often find I
have to do a lot of scrolling to find your new text.

-- 
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]


#98705

FromBarry Schwarz <schwarzb@dqel.com>
Date2016-12-10 07:57 -0800
Message-ID<f69o4c5bnptgtqtpiarj5qq1c1otg9v6mq@4ax.com>
In reply to#98680
On Sat, 10 Dec 2016 04:09:12 -0800 (PST), Alla _
<modelling.data@gmail.com> wrote:

>On Friday, December 9, 2016 at 1:08:32 PM UTC+3, Richard Heathfield wrote:

<snip>

>> 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

No one says you made any of those mistakes.  We are saying that the
data you showed does not accurately reflect the file contents.

>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 

But the authors never claimed the programs processed csv data.  You
already told us that you changed the file extension from .dat to .csv.
The programs function fine.  It is your understanding of what they do
and how you show us the results that is the problem.

>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. 


-- 
Remove del for email

[toc] | [prev] | [next] | [standalone]


#98603

FromKeith Thompson <kst-u@mib.org>
Date2016-12-09 11:40 -0800
Message-ID<lnoa0kyjpv.fsf@kst-u.example.com>
In reply to#98464
Alla _ <modelling.data@gmail.com> writes:
[...]
> ( 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 );
>         
>         // write account, name and balance into file with fprintf
>         while ( !feof( stdin ) )
>         {
>             fprintf( cfPtr, "%d %s %.2f\n", account, name, balance );
>             
>             /**
>              fprintf( stdout, "%d %s %.2f\n", account, name, balance );
>              to print the data to the standard output
>              **/
>             
>             printf( "%s", "? " );
>             scanf( "%d%29s%lf", &account, name, &balance );
>         } // end while
>         
>         fclose( cfPtr ); // fclose closes file
>         
>     } // end else
> } // end main

[...]

I have one very specific question about this.

Does the sample program in Deitel&Deitel actually use
"while ( !feof( stdin ) )"?

If so, though I'd hesitate to judge an entire book based on one
line of code, that in particular is a strike against this 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]


#98677

FromAlla _ <modelling.data@gmail.com>
Date2016-12-10 03:19 -0800
Message-ID<2ce3a902-1b4f-4487-b4f8-a18eae15f453@googlegroups.com>
In reply to#98603
On Friday, December 9, 2016 at 10:39:29 PM UTC+3, Keith Thompson wrote:
> Alla _ <modelling.data@gmail.com> writes:
> [...]
> > ( 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 );
> >         
> >         // write account, name and balance into file with fprintf
> >         while ( !feof( stdin ) )
> >         {
> >             fprintf( cfPtr, "%d %s %.2f\n", account, name, balance );
> >             
> >             /**
> >              fprintf( stdout, "%d %s %.2f\n", account, name, balance );
> >              to print the data to the standard output
> >              **/
> >             
> >             printf( "%s", "? " );
> >             scanf( "%d%29s%lf", &account, name, &balance );
> >         } // end while
> >         
> >         fclose( cfPtr ); // fclose closes file
> >         
> >     } // end else
> > } // end main
> 
> [...]
> 
> I have one very specific question about this.
> 
> Does the sample program in Deitel&Deitel actually use
> "while ( !feof( stdin ) )"?
> 
Yes. I have noted that I have posted the program written by D&D, and 
have specified only one instance, where I have added something 
different - it is not this while expression. 

> If so, though I'd hesitate to judge an entire book based on one
> line of code, that in particular is a strike against this 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]


#98703

FromBarry Schwarz <schwarzb@dqel.com>
Date2016-12-10 07:49 -0800
Message-ID<ko8o4cdjr4jac5v684bco1sg98pf6a8naq@4ax.com>
In reply to#98677
On Sat, 10 Dec 2016 03:19:19 -0800 (PST), Alla _
<modelling.data@gmail.com> wrote:

>On Friday, December 9, 2016 at 10:39:29 PM UTC+3, Keith Thompson wrote:
>> Alla _ <modelling.data@gmail.com> writes:
>> [...]
>> > ( 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 );
>> >         
>> >         // write account, name and balance into file with fprintf
>> >         while ( !feof( stdin ) )
>> >         {
>> >             fprintf( cfPtr, "%d %s %.2f\n", account, name, balance );
>> >             
>> >             /**
>> >              fprintf( stdout, "%d %s %.2f\n", account, name, balance );
>> >              to print the data to the standard output
>> >              **/
>> >             
>> >             printf( "%s", "? " );
>> >             scanf( "%d%29s%lf", &account, name, &balance );
>> >         } // end while
>> >         
>> >         fclose( cfPtr ); // fclose closes file
>> >         
>> >     } // end else
>> > } // end main
>> 
>> [...]
>> 
>> I have one very specific question about this.
>> 
>> Does the sample program in Deitel&Deitel actually use
>> "while ( !feof( stdin ) )"?
>> 
>Yes. I have noted that I have posted the program written by D&D, and 
>have specified only one instance, where I have added something 
>different - it is not this while expression. 
>
>> If so, though I'd hesitate to judge an entire book based on one
>> line of code, that in particular is a strike against this one.

Given that there is a call to scanf immediately prior to testing feof,
the only thing wrong with the loop is it will fail if there is an I/O
error.  Depending on how much I/O discussion has preceded this
program, it may not be unreasonable from a syllabus perspecive to
defer error checking till a later exercise.

-- 
Remove del for email

[toc] | [prev] | [next] | [standalone]


#98709

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2016-12-10 16:11 +0000
Message-ID<878trn3gss.fsf@bsb.me.uk>
In reply to#98703
Barry Schwarz <schwarzb@dqel.com> writes:

> On Sat, 10 Dec 2016 03:19:19 -0800 (PST), Alla _
> <modelling.data@gmail.com> wrote:
>
>>On Friday, December 9, 2016 at 10:39:29 PM UTC+3, Keith Thompson wrote:
>>> Alla _ <modelling.data@gmail.com> writes:
<snip>
>>> >         scanf( "%d%29s%lf", &account, name, &balance );
>>> >         
>>> >         // write account, name and balance into file with fprintf
>>> >         while ( !feof( stdin ) )
>>> >         {
>>> >             fprintf( cfPtr, "%d %s %.2f\n", account, name, balance );
>>> >             
<snip>
>>> >             
>>> >             printf( "%s", "? " );
>>> >             scanf( "%d%29s%lf", &account, name, &balance );
>>> >         } // end while
<snip>

>>> I have one very specific question about this.
>>> 
>>> Does the sample program in Deitel&Deitel actually use
>>> "while ( !feof( stdin ) )"?
>>> 
>>Yes. I have noted that I have posted the program written by D&D, and 
>>have specified only one instance, where I have added something 
>>different - it is not this while expression. 
>>
>>> If so, though I'd hesitate to judge an entire book based on one
>>> line of code, that in particular is a strike against this one.
>
> Given that there is a call to scanf immediately prior to testing feof,
> the only thing wrong with the loop is it will fail if there is an I/O
> error.

"I/O error" is a very general term, but in the context of comp.lang.c it
might reasonably be taken to mean those errors detected by ferror().
Those errors don't cause the loop to fail, of course, they cause it
simply to (correctly) end.  Conversion errors, on the other hand, do
cause the loop to fail in the sense of "going horribly wrong".  I'm not
sure if you were including conversion errors in "I/O errors" which I why
I've written a whole paragraph about stuff I'm sure you know!

> Depending on how much I/O discussion has preceded this
> program, it may not be unreasonable from a syllabus perspecive to
> defer error checking till a later exercise.

I would say that is the whole point.  If there has not been enough
discussion of IO for the reader to know that

  while (scanf("....", ....) == the_number_of_items_expected) {
      ... process the items ...
  }

is the simplest way to process a data stream, then that is a significant
criticism of the book.  As soon as scanf is introduced, I think you need
to say that suitable input may not be found and that this can easily be
handled by writing

  if (scanf("%d", &number) == 1) ...

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#98743

FromKeith Thompson <kst-u@mib.org>
Date2016-12-10 14:45 -0800
Message-ID<ln60mrwgh9.fsf@kst-u.example.com>
In reply to#98709
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Barry Schwarz <schwarzb@dqel.com> writes:
>
>> On Sat, 10 Dec 2016 03:19:19 -0800 (PST), Alla _
>> <modelling.data@gmail.com> wrote:
>>
>>>On Friday, December 9, 2016 at 10:39:29 PM UTC+3, Keith Thompson wrote:
>>>> Alla _ <modelling.data@gmail.com> writes:
> <snip>
>>>> >         scanf( "%d%29s%lf", &account, name, &balance );
>>>> >         
>>>> >         // write account, name and balance into file with fprintf
>>>> >         while ( !feof( stdin ) )
>>>> >         {
>>>> >             fprintf( cfPtr, "%d %s %.2f\n", account, name, balance );
>>>> >             
> <snip>
>>>> >             
>>>> >             printf( "%s", "? " );
>>>> >             scanf( "%d%29s%lf", &account, name, &balance );
>>>> >         } // end while
> <snip>
>
>>>> I have one very specific question about this.
>>>> 
>>>> Does the sample program in Deitel&Deitel actually use
>>>> "while ( !feof( stdin ) )"?
>>>> 
>>>Yes. I have noted that I have posted the program written by D&D, and 
>>>have specified only one instance, where I have added something 
>>>different - it is not this while expression. 
>>>
>>>> If so, though I'd hesitate to judge an entire book based on one
>>>> line of code, that in particular is a strike against this one.
>>
>> Given that there is a call to scanf immediately prior to testing feof,
>> the only thing wrong with the loop is it will fail if there is an I/O
>> error.

Yes, I think you're right.  feof() returns true only after a failing
scanf() call, which will return a value other than 3 (which the program
quietly ignores).

But the fact that it happens to work in this case does not, IMHO,
justify teaching this particular bad habit.

My judgement of the book would depend in part on how it discusses this
issue later on.

> "I/O error" is a very general term, but in the context of comp.lang.c it
> might reasonably be taken to mean those errors detected by ferror().
> Those errors don't cause the loop to fail, of course, they cause it
> simply to (correctly) end.  Conversion errors, on the other hand, do
> cause the loop to fail in the sense of "going horribly wrong".  I'm not
> sure if you were including conversion errors in "I/O errors" which I why
> I've written a whole paragraph about stuff I'm sure you know!

An I/O error of the kind detected by ferror() will cause an infinite
loop.

The loop is:
    while ( !feof( stdin ) )
    /* ... */

If an error causes ferror(stdin) to return true, feof(stdin) will
continue to return false.

[...]

-- 
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]


#98745

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2016-12-10 22:59 +0000
Message-ID<87a8c31jcx.fsf@bsb.me.uk>
In reply to#98743
Keith Thompson <kst-u@mib.org> writes:

> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
<snip>
>> "I/O error" is a very general term, but in the context of comp.lang.c it
>> might reasonably be taken to mean those errors detected by ferror().
>> Those errors don't cause the loop to fail, of course, they cause it
>> simply to (correctly) end.  Conversion errors, on the other hand, do
>> cause the loop to fail in the sense of "going horribly wrong".  I'm not
>> sure if you were including conversion errors in "I/O errors" which I why
>> I've written a whole paragraph about stuff I'm sure you know!
>
> An I/O error of the kind detected by ferror() will cause an infinite
> loop.
>
> The loop is:
>     while ( !feof( stdin ) )
>     /* ... */

Yes, thanks.  I got that mixed with a point I was going to make about
BartC's eof() which detects error as well.  I need to take more time
these days...

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#98387

FromLew Pitcher <lew.pitcher@digitalfreehold.ca>
Date2016-12-08 11:26 -0500
Message-ID<o2c1gp$ulr$1@dont-email.me>
In reply to#98342
On Thursday December 8 2016 02:29, in comp.lang.c, "Alla _"
<modelling.data@gmail.com> 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.
>> >>> 
>> >>>> You need to review how fscanf() determines where each input field
>> >>>> starts and ends, and what it (fscanf) does when it cannot find a
>> >>>> specified field.
>> >>> 
>> >>> Yes, and she also needs to learn what is meant by "CSV".
>> >>
>> >>Yes, indeed. But even that isn't enough.
>> >>Question: With fscanf(), what character sequence delimits the end of a
>> >>string?
>> > 
>> > A white space character (or exhausting the count if specified).
>> 
>> That was a rhetorical question, for Alla's benefit.
>> 
>> Let's note that "white space" includes
>>   ' '  (space),
>>   '\f' (formfeed),
>>   '\n' (newline - that character (sequence) that separates lines
>>         in a text file),
>>   '\r' (carriage return),
>>   '\t' (horizontal tab), and
>>   '\v' (vertical tab)
>> 
>> Alla, do you see a problem with your fscanf() parsing of the name field?
> 
> I am sorry for asking this: what exactly does "name field" mean in this
> context; does it mean account, name, and balance?
>  fscanf( cfPtr, "%d%29s%lf", &account, name, &balance );

By "name field", I meant the portion of your input line data that you wish
fscanf() to extract into the variable you call <<name>>. 

What I (and Richard H) have been hinting at is that your fscanf() format field
(the "%d%29s%lf" string) WILL NOT properly extract the three data items you
indicate that exist in your Comma Separated Values file.

> You have asked a very important question, and I have to clear up this issue,
> because in a program I am preparing I have to write

I think that you mean "read"

> data from the excel file;

I'm sorry, but now I am confused.

At first, you said you wanted to read a CSV (Comma Separated Values) file, and
the code you have presented /almost/ does that. Now, you talk of accessing
(read? write?) an "excel file". Excel can import data from CSV files, and
export data to CSV files, but the phrase "excel file" usually refers to a
file in XLS (or XLSX) format, and not CSV.

In either case, your code does not do that. It neither reads nor writes in CSV
or "excel file" format.

> and I wonder if I need to convert that file into csv format first to 
> be able to extract the data.

Okay. That seems to be out of scope for both the D&D code and your own. 

> Please, do not address this issue for now, because it will start a
> completely new discussion, which requires a separate 
> thread.

Agreed.

> Now it is important for me to make sure I understand and know what 
> you are referring to in your question.

OK.

To me, you have a number of problem areas that you need to investigate and
fix.

1) You need to understand the appropriate use of the feof() function. By this,
   I mean that you need to understand what condition it indicates, and where
   it is best used in your code.

2) You need to determine whether or not fscanf() is the appropriate function
   to extract individual data items from your input data. ASSUMING that your
   input data is formatted as a COMMA SEPARATED VALUES (CSV) file, you will
   find it difficult to use fscanf() to extract that data correctly.

3) If you choose to use fscanf() to extract data from your input file, you
   will need to understand how fscanf() finds the start and end of each data
   item. For your purposes, this is not trivial. Consider, in a CSV file, the
   commas separate each data element, but they are not part of the data
   element. That means that you have to use the commas as the terminator for
   one field, and begin the next field /after/ the comma. If your input
   consisted of a line that looked like
     190,mary,89.00
   and you wanted to split it up to populate three variables:
     unsigned int account; 
     char name[ 30 ]; 
     double balance;
   then
     account must contain the integer 190,
     name must contain the string "mary", and
     balance must contain the double-precision floatingpoint value 89.00
      (89E0).
   and you do not want to include the commas anywhere in the extracted data.
   Question to you: can you do this with a single fscanf() call? Can you do
   this with multiple fscanf() calls? What fscanf() format string (or strings,
   if multiple calls) will accomplish this?

Hope this helps.
-- 
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request

[toc] | [prev] | [next] | [standalone]


#98391

FromLew Pitcher <lew.pitcher@digitalfreehold.ca>
Date2016-12-08 11:48 -0500
Message-ID<o2c2pm$ulr$3@dont-email.me>
In reply to#98387
I'll add one more "consideration" to my list...

On Thursday December 8 2016 11:26, in comp.lang.c, "Lew Pitcher"
<lew.pitcher@digitalfreehold.ca> wrote:

> On Thursday December 8 2016 02:29, in comp.lang.c, "Alla _"
> <modelling.data@gmail.com> 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.
>>> >>> 
>>> >>>> You need to review how fscanf() determines where each input field
>>> >>>> starts and ends, and what it (fscanf) does when it cannot find a
>>> >>>> specified field.
>>> >>> 
>>> >>> Yes, and she also needs to learn what is meant by "CSV".
>>> >>
>>> >>Yes, indeed. But even that isn't enough.
>>> >>Question: With fscanf(), what character sequence delimits the end of a
>>> >>string?
>>> > 
>>> > A white space character (or exhausting the count if specified).
>>> 
>>> That was a rhetorical question, for Alla's benefit.
>>> 
>>> Let's note that "white space" includes
>>>   ' '  (space),
>>>   '\f' (formfeed),
>>>   '\n' (newline - that character (sequence) that separates lines
>>>         in a text file),
>>>   '\r' (carriage return),
>>>   '\t' (horizontal tab), and
>>>   '\v' (vertical tab)
>>> 
>>> Alla, do you see a problem with your fscanf() parsing of the name field?
>> 
>> I am sorry for asking this: what exactly does "name field" mean in this
>> context; does it mean account, name, and balance?
>>  fscanf( cfPtr, "%d%29s%lf", &account, name, &balance );
> 
> By "name field", I meant the portion of your input line data that you wish
> fscanf() to extract into the variable you call <<name>>.
> 
> What I (and Richard H) have been hinting at is that your fscanf() format
> field (the "%d%29s%lf" string) WILL NOT properly extract the three data
> items you indicate that exist in your Comma Separated Values file.
> 
>> You have asked a very important question, and I have to clear up this
>> issue, because in a program I am preparing I have to write
> 
> I think that you mean "read"
> 
>> data from the excel file;
> 
> I'm sorry, but now I am confused.
> 
> At first, you said you wanted to read a CSV (Comma Separated Values) file,
> and the code you have presented /almost/ does that. Now, you talk of
> accessing (read? write?) an "excel file". Excel can import data from CSV
> files, and export data to CSV files, but the phrase "excel file" usually
> refers to a file in XLS (or XLSX) format, and not CSV.
> 
> In either case, your code does not do that. It neither reads nor writes in
> CSV or "excel file" format.
> 
>> and I wonder if I need to convert that file into csv format first to
>> be able to extract the data.
> 
> Okay. That seems to be out of scope for both the D&D code and your own.
> 
>> Please, do not address this issue for now, because it will start a
>> completely new discussion, which requires a separate
>> thread.
> 
> Agreed.
> 
>> Now it is important for me to make sure I understand and know what
>> you are referring to in your question.
> 
> OK.
> 
> To me, you have a number of problem areas that you need to investigate and
> fix.
> 
> 1) You need to understand the appropriate use of the feof() function. By
> this,
>    I mean that you need to understand what condition it indicates, and where
>    it is best used in your code.
> 
> 2) You need to determine whether or not fscanf() is the appropriate function
>    to extract individual data items from your input data. ASSUMING that your
>    input data is formatted as a COMMA SEPARATED VALUES (CSV) file, you will
>    find it difficult to use fscanf() to extract that data correctly.
> 
> 3) If you choose to use fscanf() to extract data from your input file, you
>    will need to understand how fscanf() finds the start and end of each data
>    item. For your purposes, this is not trivial. Consider, in a CSV file,
>    the commas separate each data element, but they are not part of the data
>    element. That means that you have to use the commas as the terminator for
>    one field, and begin the next field /after/ the comma. If your input
>    consisted of a line that looked like
>      190,mary,89.00
>    and you wanted to split it up to populate three variables:
>      unsigned int account;
>      char name[ 30 ];
>      double balance;
>    then
>      account must contain the integer 190,
>      name must contain the string "mary", and
>      balance must contain the double-precision floatingpoint value 89.00
>       (89E0).
>    and you do not want to include the commas anywhere in the extracted data.
>    Question to you: can you do this with a single fscanf() call? Can you do
>    this with multiple fscanf() calls? What fscanf() format string (or
>    strings, if multiple calls) will accomplish this?

4) No matter which function (fscanf() or other) you use to extract data from
   your input file, you will have to understand how that function indicates
   success or failure. Consider your fscanf() format line:
     "%d%29s%lf"
   which tells fscanf() to look for three (3) different fields.
   What happens when your input contains only two (2) of those fields?
   What happens if your format line /incorrectly/ describes the input data?
   What happens when you run out of input data and reach end-of-file.


> Hope this helps.


-- 
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request

[toc] | [prev] | [next] | [standalone]


#98994

FromAlla _ <modelling.data@gmail.com>
Date2016-12-11 23:33 -0800
Message-ID<38990829-5ec8-4607-afa9-fd9187d6b014@googlegroups.com>
In reply to#98391
<snip>
> > To me, you have a number of problem areas that you need to investigate and
> > fix.
> > 
> > 1) You need to understand the appropriate use of the feof() function. By
> > this,
> >    I mean that you need to understand what condition it indicates, and where
> >    it is best used in your code.
> > 
> > 2) You need to determine whether or not fscanf() is the appropriate function
> >    to extract individual data items from your input data. ASSUMING that your
> >    input data is formatted as a COMMA SEPARATED VALUES (CSV) file, you will
> >    find it difficult to use fscanf() to extract that data correctly.
> > 
> > 3) If you choose to use fscanf() to extract data from your input file, you
> >    will need to understand how fscanf() finds the start and end of each data
> >    item. For your purposes, this is not trivial. Consider, in a CSV file,
> >    the commas separate each data element, but they are not part of the data
> >    element. That means that you have to use the commas as the terminator for
> >    one field, and begin the next field /after/ the comma. If your input
> >    consisted of a line that looked like
> >      190,mary,89.00
> >    and you wanted to split it up to populate three variables:
> >      unsigned int account;
> >      char name[ 30 ];
> >      double balance;
> >    then
> >      account must contain the integer 190,
> >      name must contain the string "mary", and
> >      balance must contain the double-precision floatingpoint value 89.00
> >       (89E0).
> >    and you do not want to include the commas anywhere in the extracted data.
> >    Question to you: can you do this with a single fscanf() call? Can you do
> >    this with multiple fscanf() calls? What fscanf() format string (or
> >    strings, if multiple calls) will accomplish this?
> 
> 4) No matter which function (fscanf() or other) you use to extract data from
>    your input file, you will have to understand how that function indicates
>    success or failure. Consider your fscanf() format line:
>      "%d%29s%lf"
>    which tells fscanf() to look for three (3) different fields.
>    What happens when your input contains only two (2) of those fields?
>    What happens if your format line /incorrectly/ describes the input data?
>    What happens when you run out of input data and reach end-of-file.
> 
> 
> > Hope this helps.
> 
> 
I am very sorry I didn't answer before - thank you very much. This is indeed 
very helpful list of things I should know, learn if not known, and always keep in
mind. 
> -- 
> Lew Pitcher
> "In Skills, We Trust"
> PGP public key available upon request

[toc] | [prev] | [next] | [standalone]


#98340

FromAlla _ <modelling.data@gmail.com>
Date2016-12-07 23:09 -0800
Message-ID<99b9ebf1-bc0e-4b21-8e4c-caf621416b3b@googlegroups.com>
In reply to#98277
On Wednesday, December 7, 2016 at 8:46:03 PM UTC+3, Lew Pitcher wrote:
> On Wednesday December 7 2016 08:08, in comp.lang.c, "Alla _"
> <modelling.data@gmail.com> wrote:
> 
> > Hello!
> > 
> > Please, take a look at the same program but two versions of it. The first
> > version is is written by Deitel&Deitel; in the second version I would like
> > to change the while loop into a do while one, but is it possible to set a
> > condition of the while statement such that the loop ends right before the
> > EOF, i.e. to escape printing the last line twice? 
> [snip]
> > (2) my version with the do while loop:
> > 
> 
> I make no comments on the correctness of this code other than on the specific
> use of feof(). I know that this code doesn't do what you claim it does, and I
> know /why/ it doesn't work.
> 
> > // Reading and printing a sequential file
> > #include <stdio.h>
> > 
> > int main( void )
> > {
> >     unsigned int account;
> >     char name[ 30 ];
> >     double balance;
> >     
> >     FILE *cfPtr;
> >     
> >     // fopen opens file; exits program if file cannot be opened
> >     if ((cfPtr = fopen( "clients.csv", "r" )) == NULL )
> >     {
> >         puts( "File could not be opened" );
> >     }
> >     else
> >     {
> >         printf( "%-10s%-13s%s\n", "Account", "Name", "Balance" );
> >         do
> >         {
> >             fscanf( cfPtr, "%d%29s%lf", &account, name, &balance );
> >             printf( "%-10d%-13s%7.2f\n", account, name, balance );
> >         }
> >         while (!feof( cfPtr ));
> 
> "The feof function tests the end-of-file indicator for the stream pointed to by
> stream." (so says the C standard). The end-of-file indicator is set when a
> file read function (like fgets(), fscanf(), etc) can no longer read data from
> the file. In other words, the end-of-file indicator is set AFTER the read
> determines that there is no more data.
> 
> Assume that you have successfully processed almost all the lines in your input
> file, and are about to process the last line.
> 
> At the top of your do-while:
>  -  fscanf() pulls in the remaining line and populates account, name and
>     balance. it does /not/ set the end-of-file indicator.
>  -  printf() prints the values in account, name, and balance
>  -  feof(cfPtr) returns 0 because we have not yet reached end-of-file
>     and the do-while starts again.
>  -  fscanf() encounters the end of the file, and sets the end-of-file
>     indicator
>  -  printf prints the values in account, name and balance
>  -  feof(cfPtr) returns 1 because the end-of-file indicator is now set,
>     and the loop terminates.
> 
Thank you. But this is exactly what I have said; I understand this.

> See the problem? You print the last line twice because your logic does not
> test for end-of-file at a point to avoid printing the leftovers from the
> previous loop.
> 
> >     fclose( cfPtr );
> >     }
> > }
> > Output:
> > 
> > Account   Name         Balance
> > 190       mary           89.00
> > 34        john           89.00
> > 367       sandra         46.00
> > 367       sandra         46.00
> > 
> > Thank you!
> 
> Like Richard, I get an infinite loop of ill-formed data.
> 
> You need to review how fscanf() determines where each input field starts and
> ends, and what it (fscanf) does when it cannot find a specified field.
> 
> 
> -- 
> Lew Pitcher
> "In Skills, We Trust"
> PGP public key available upon request

[toc] | [prev] | [next] | [standalone]


#98279

FromKeith Thompson <kst-u@mib.org>
Date2016-12-07 09:53 -0800
Message-ID<ln4m2f39se.fsf@kst-u.example.com>
In reply to#98254
Alla _ <modelling.data@gmail.com> writes:
> Please, take a look at the same program but two versions of it. The
> first version is is written by Deitel&Deitel; in the second version I
> would like to change the while loop into a do while one, but is it
> possible to set a condition of the while statement such that the loop
> ends right before the EOF, i.e.  to escape printing the last line
> twice? Please, note that I understand that the current version (2)
> does print the last line twice because the loop ends only when EOF is
> true, and that happens on the forth iteration. Is there a reasonably
> simple way to avoid double printing of the last line, or do while loop
> won't work in such circumstances?

Why do you want to change a while loop to a do-while loop?

A while loop will execute zero or more times.  A do-while loop tests the
condition at the bottom, and executes at least once.  A text file can
contain zero or more lines.  A loop that processes each line should
execute N times, where N is the number of lines in the input.

A while loop is the right tool for reading input from a (possibly empty)
file.  A do-while loop is not.

[...]

> (1) original program:
>
> // Reading and printing a sequential file
[...]
>       // while not end of file
>         while (!feof( cfPtr ))
>         {
>           printf( "%-10d%-13s%7.2f\n", account, name, balance );
>           fscanf( cfPtr, "%d%29s%lf", &account, name, &balance );
>         }

Hmm.  Did Deitel&Deitel really use this method?  (I don't have a copy.)
If so, do they show a later example that doesn't use feof() to determine
when the loop is finished?

The feof() function is not intended to be used to control an input
loop.  It, along with ferror(), can be used after a loop finishes to
determine why it finished.

The value returned by feof() becomes true *after* an input failure
occurs.

An input loop should test the value returned by the input function
(getchar(), fgets(), fscanf(), whatever you're using).  Every input
function has a way to tell you that there was no more input; you'll have
to read the documentation for whatever function you're using.  fscanf()
returns the value EOF on certain errors; otherwise it returns the number
of items scanned.  Since the call here attempts to scan 3 items, you can
assume you're done if it returns any value other than 3.

Typically you'll want to put the input call in the condition.  For
example, the usual way to read input a character at a time is:

    while ((c = getchar()) != EOF) {
        /* ... */
    }

Note that if there's an I/O error on input, ferror() will return
true after the error occurs and feof() will *never* return true,
so you'll have an infinite loop.

[...]

-- 
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]


#98285

FromBarry Schwarz <schwarzb@dqel.com>
Date2016-12-07 11:26 -0800
Message-ID<ekng4c1j9bn9uctjqe5unff4a7pvljge4u@4ax.com>
In reply to#98254
On Wed, 7 Dec 2016 05:08:44 -0800 (PST), Alla _
<modelling.data@gmail.com> wrote:

>Hello!
>
>Please, take a look at the same program but two versions of it. The first version is 
>is written by Deitel&Deitel; in the second version I would like to change 
>the while loop into a do while one, but is it possible to set a condition of 
>the while statement such that the loop ends right before the EOF, i.e. 

There is no while statement.  There is a while expression that is part
of the do-while statement.  Since the while expression is not
evaluated till the end of loop, nothing it contains can affect the
operation of the current iteration of the loop.  So the answer to this
part of the question is NO.

>to escape printing the last line twice? Please, note that I understand that 

There are methods of preventing the duplicate last line output.  See
my examples in your code.

>the current version (2) does print the last line twice because the loop ends only
>when EOF is true, and that happens on the forth iteration. Is there a reasonably
>simple way to avoid double printing of the last line, or do while loop won't work 
>in such circumstances? 
>Few words about the program:
>- to test the original program I have created a csv file that has 3 lines of data;
>- the original program correctly prints out three lines and stops at the EOF;
>- I would like to achieve the same result using do while loop. 

Why do you want to learn bad habits?

<snip>

>(2) my version with the do while loop:
>
>
>// Reading and printing a sequential file
>#include <stdio.h>
>
>int main( void )
>{
>    unsigned int account; 
>    char name[ 30 ]; 
>    double balance; 
>    
>    FILE *cfPtr; 
>    
>    // fopen opens file; exits program if file cannot be opened
>    if ((cfPtr = fopen( "clients.csv", "r" )) == NULL )
>    {
>        puts( "File could not be opened" );
>    } 
>    else
>    {
>        printf( "%-10s%-13s%s\n", "Account", "Name", "Balance" );
>        do
>        {

Example 1:  Place the call to fscanf inside an if statement:
      if (fscanf( cfPtr, "%d%29s%lf", &account, name, &balance ) > 0)
Now the following call to printf will not execute if fscanf fails.

>            fscanf( cfPtr, "%d%29s%lf", &account, name, &balance );

Example 2:  Insert an feof test just prior to the call to printf:
     if (!feof( cfPtr ))
Same effect as above.

>            printf( "%-10d%-13s%7.2f\n", account, name, balance );
>        }
>        while (!feof( cfPtr ));
>
>    fclose( cfPtr ); 
>    } 
>}
>Output:
>
>Account   Name         Balance
>190       mary           89.00
>34        john           89.00
>367       sandra         46.00
>367       sandra         46.00
>
>Thank you! 

-- 
Remove del for email

[toc] | [prev] | [next] | [standalone]


#98287

FromKeith Thompson <kst-u@mib.org>
Date2016-12-07 11:50 -0800
Message-ID<lnzik71pt3.fsf@kst-u.example.com>
In reply to#98285
Barry Schwarz <schwarzb@dqel.com> writes:
[...]
> Example 1:  Place the call to fscanf inside an if statement:
>       if (fscanf( cfPtr, "%d%29s%lf", &account, name, &balance ) > 0)
> Now the following call to printf will not execute if fscanf fails.

I'd write "== 3" rather than "> 0".  fscanf() could return 1 or 2 if
it's able to read only 1 or 2 items rather than the requested 3.  You
might want to treat reading 1 or 2 items differently from other kinds of
failure, but for a small demo program like this it's probably best to
treat anything other than 3 as an error.

>>            fscanf( cfPtr, "%d%29s%lf", &account, name, &balance );
>
> Example 2:  Insert an feof test just prior to the call to printf:
>      if (!feof( cfPtr ))
> Same effect as above.

Not quite.  feof() will return false (0) if no more input is available
due to an I/O error; in that case ferror() will return true.

[...]

-- 
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]


#98341

FromAlla _ <modelling.data@gmail.com>
Date2016-12-07 23:12 -0800
Message-ID<829a9faa-c03a-4bc7-b029-ab44e3f021ef@googlegroups.com>
In reply to#98285
On Wednesday, December 7, 2016 at 10:26:37 PM UTC+3, Barry Schwarz wrote:
> On Wed, 7 Dec 2016 05:08:44 -0800 (PST), Alla _
> <modelling.data@gmail.com> wrote:
> 
> >Hello!
> >
> >Please, take a look at the same program but two versions of it. The first version is 
> >is written by Deitel&Deitel; in the second version I would like to change 
> >the while loop into a do while one, but is it possible to set a condition of 
> >the while statement such that the loop ends right before the EOF, i.e. 
> 
> There is no while statement.  There is a while expression that is part
> of the do-while statement.  Since the while expression is not
> evaluated till the end of loop, nothing it contains can affect the
> operation of the current iteration of the loop.  So the answer to this
> part of the question is NO.
> 
> >to escape printing the last line twice? Please, note that I understand that 
> 
> There are methods of preventing the duplicate last line output.  See
> my examples in your code.
Thank you )
> 
> >the current version (2) does print the last line twice because the loop ends only
> >when EOF is true, and that happens on the forth iteration. Is there a reasonably
> >simple way to avoid double printing of the last line, or do while loop won't work 
> >in such circumstances? 
> >Few words about the program:
> >- to test the original program I have created a csv file that has 3 lines of data;
> >- the original program correctly prints out three lines and stops at the EOF;
> >- I would like to achieve the same result using do while loop. 
> 
> Why do you want to learn bad habits?
I wonder why I see the "why" so many times: I have explained my reasoning, 
although I now understand that it was a poor one )
 
> 
> <snip>
> 
> >(2) my version with the do while loop:
> >
> >
> >// Reading and printing a sequential file
> >#include <stdio.h>
> >
> >int main( void )
> >{
> >    unsigned int account; 
> >    char name[ 30 ]; 
> >    double balance; 
> >    
> >    FILE *cfPtr; 
> >    
> >    // fopen opens file; exits program if file cannot be opened
> >    if ((cfPtr = fopen( "clients.csv", "r" )) == NULL )
> >    {
> >        puts( "File could not be opened" );
> >    } 
> >    else
> >    {
> >        printf( "%-10s%-13s%s\n", "Account", "Name", "Balance" );
> >        do
> >        {
> 
> Example 1:  Place the call to fscanf inside an if statement:
>       if (fscanf( cfPtr, "%d%29s%lf", &account, name, &balance ) > 0)
> Now the following call to printf will not execute if fscanf fails.
> 
> >            fscanf( cfPtr, "%d%29s%lf", &account, name, &balance );
> 
> Example 2:  Insert an feof test just prior to the call to printf:
>      if (!feof( cfPtr ))
> Same effect as above.
> 
> >            printf( "%-10d%-13s%7.2f\n", account, name, balance );
> >        }
> >        while (!feof( cfPtr ));
> >
> >    fclose( cfPtr ); 
> >    } 
> >}
> >Output:
> >
> >Account   Name         Balance
> >190       mary           89.00
> >34        john           89.00
> >367       sandra         46.00
> >367       sandra         46.00
> >
> >Thank you! 
> 
> -- 
> Remove del for email

[toc] | [prev] | [next] | [standalone]


#98344

FromRichard Heathfield <rjh@cpax.org.uk>
Date2016-12-08 07:31 +0000
Message-ID<o2b25v$n0f$2@dont-email.me>
In reply to#98341
On 08/12/16 07:12, Alla _ wrote:
> On Wednesday, December 7, 2016 at 10:26:37 PM UTC+3, Barry Schwarz wrote:
<snip>
>>
>> Why do you want to learn bad habits?
> I wonder why I see the "why" so many times:

Because you keep making bad choices. This puzzles some people.

-- 
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]


#98349

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2016-12-08 11:00 +0000
Message-ID<87d1h2d6sa.fsf@bsb.me.uk>
In reply to#98344
Richard Heathfield <rjh@cpax.org.uk> writes:

> On 08/12/16 07:12, Alla _ wrote:
>> On Wednesday, December 7, 2016 at 10:26:37 PM UTC+3, Barry Schwarz wrote:
> <snip>
>>>
>>> Why do you want to learn bad habits?
>> I wonder why I see the "why" so many times:
>
> Because you keep making bad choices. This puzzles some people.

But these are all about one choice.  The explanation is more likely to
be the asynchronous nature of Usenet.  Everyone who replies will
probably have the same question but they won't always have read the
other replies that also ask it.

Furthermore, when I see a question asked and answered, I'll definitively
try to try to remember that and snip that part when I reply (or put a "I
see you've explained this elsewhere" remark), but when it's just an as
yet unanswered question, I will sometimes ask again simply to allow the
OP more options about where to answer it.  They can always say "see my
other reply", so I don't consider it a burden, but I can see that it
will sometimes appear as if everyone is banging on about it.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#98460

FromAlla _ <modelling.data@gmail.com>
Date2016-12-09 00:48 -0800
Message-ID<d547c5fc-a389-43c4-92b3-652848e3b962@googlegroups.com>
In reply to#98349
On Thursday, December 8, 2016 at 2:01:09 PM UTC+3, Ben Bacarisse wrote:
> Richard Heathfield <rjh@cpax.org.uk> writes:
> 
> > On 08/12/16 07:12, Alla _ wrote:
> >> On Wednesday, December 7, 2016 at 10:26:37 PM UTC+3, Barry Schwarz wrote:
> > <snip>
> >>>
> >>> Why do you want to learn bad habits?
> >> I wonder why I see the "why" so many times:
> >
> > Because you keep making bad choices. This puzzles some people.
> 
> But these are all about one choice.  The explanation is more likely to
> be the asynchronous nature of Usenet.  Everyone who replies will
> probably have the same question but they won't always have read the
> other replies that also ask it.
> 
> Furthermore, when I see a question asked and answered, I'll definitively
> try to try to remember that and snip that part when I reply (or put a "I
> see you've explained this elsewhere" remark), but when it's just an as
> yet unanswered question, I will sometimes ask again simply to allow the
> OP more options about where to answer it.  They can always say "see my
> other reply", so I don't consider it a burden, but I can see that it
> will sometimes appear as if everyone is banging on about it.

Indeed. I have thought about the reasons you suggested, but, unfortunately,
only upon posting my reply; I try my best to avoid responding quickly, and do 
my best to understand motivations first, and only than post a sort of one-dimensional 
comment/reply ) Failed this time ) 
> 
> -- 
> Ben.

[toc] | [prev] | [next] | [standalone]


#98737

FromSiri Cruise <chine.bleu@yahoo.com>
Date2016-12-10 13:49 -0800
Message-ID<chine.bleu-78DD83.13485710122016@news.eternal-september.org>
In reply to#98254
In article <52f1c174-6af1-4fda-9ff8-a5e2cf507b5f@googlegroups.com>,
 Alla _ <modelling.data@gmail.com> wrote:

> Hello!
> 
> Please, take a look at the same program but two versions of it. The first 
> version is 

That's why it's a convenient to have a one-and-half times loop.
        do 
            <statement>
        while (predicate)
            <statement>

Algol68 supported this because declarations could appear in the predicate and 
their scope included the iterated statement.
        while int c = fetch input character; not eof do
            do something with(c);
        od

Since many statements in C are expressions that can be put together with a 
commas, you can sort of do this C, except declaring variables in the predicate 
for the loop body.
        int c;
        while (c=fetchinputcharacter(), not eof) {
            dosomethingwith(c);
        }

With the new for loop.
        for (int c=0; (c=fetchinputcharacter(), not eof); ) {
            dosomethingwith(c);
        }

-- 
:-<> Siri Seal of Disavowal #000-001. Disavowed. Denied. Deleted.
'I desire mercy, not sacrifice.'
Free the Amos Yee one.
Yeah, too bad about your so-called life. Ha-ha.

[toc] | [prev] | [standalone]


Page 9 of 9 — ← Prev page 1 2 3 4 5 6 7 8 [9]

Back to top | Article view | comp.lang.c


csiph-web