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


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

How to read a data file whose size is unknown in C?

Started byfl <rxjwg98@gmail.com>
First post2015-08-12 15:28 -0700
Last post2015-08-14 09:03 -0700
Articles 20 on this page of 164 — 27 participants

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


Contents

  How to read a data file whose size is unknown in C? fl <rxjwg98@gmail.com> - 2015-08-12 15:28 -0700
    Re: How to read a data file whose size is unknown in C? Richard Heathfield <rjh@cpax.org.uk> - 2015-08-12 23:52 +0100
      Re: How to read a data file whose size is unknown in C? fl <rxjwg98@gmail.com> - 2015-08-12 16:13 -0700
        Re: How to read a data file whose size is unknown in C? Richard Heathfield <rjh@cpax.org.uk> - 2015-08-13 00:33 +0100
        Re: How to read a data file whose size is unknown in C? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-13 00:06 +0000
          Re: How to read a data file whose size is unknown in C? raltbos@xs4all.nl (Richard Bos) - 2015-08-13 20:50 +0000
            Re: How to read a data file whose size is unknown in C? Stephen Sprunk <stephen@sprunk.org> - 2015-08-17 13:38 -0500
              Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-17 14:48 -0400
              Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-18 11:10 +0100
                Re: How to read a data file whose size is unknown in C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-18 15:01 +0100
        Re: How to read a data file whose size is unknown in C? gordonb.8n5lc@burditt.org (Gordon Burditt) - 2015-08-14 02:33 -0500
          Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-14 10:06 +0200
            Re: How to read a data file whose size is unknown in C? Richard Heathfield <rjh@cpax.org.uk> - 2015-08-14 09:14 +0100
              Re: How to read a data file whose size is unknown in C? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-14 21:27 +0000
                Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-15 09:52 +0200
            Re: How to read a data file whose size is unknown in C? Nobody <nobody@nowhere.invalid> - 2015-08-15 01:17 +0100
              Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-15 10:27 +0200
                Re: How to read a data file whose size is unknown in C? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-15 18:09 +0000
                  Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-15 22:05 +0200
                    Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-15 19:17 -0700
                Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-15 13:50 -0700
                  Re: How to read a data file whose size is unknown in C? Richard Heathfield <rjh@cpax.org.uk> - 2015-08-15 21:37 +0100
                    Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-15 23:33 +0200
                      Re: How to read a data file whose size is unknown in C? Richard Heathfield <rjh@cpax.org.uk> - 2015-08-15 22:58 +0100
                        Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-16 00:08 +0200
                          Re: How to read a data file whose size is unknown in C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-16 00:40 +0100
                            Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-16 02:23 +0200
                              Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-15 19:37 -0700
                            Re: How to read a data file whose size is unknown in C? gazelle@shell.xmission.com (Kenny McCormack) - 2015-08-16 15:35 +0000
                              Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-16 10:31 -0700
                    Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-15 19:21 -0700
                  Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-15 23:31 +0200
                  Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-16 03:38 -0700
                    Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-16 17:29 -0700
                      Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-17 01:46 -0700
                        Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-17 09:03 -0700
                Re: How to read a data file whose size is unknown in C? Nobody <nobody@nowhere.invalid> - 2015-08-16 03:23 +0100
                Re: How to read a data file whose size is unknown in C? Philip Lantz <prl@canterey.us> - 2015-08-17 00:56 -0700
                  Re: How to read a data file whose size is unknown in C? Philip Lantz <prl@canterey.us> - 2015-08-17 01:08 -0700
                  Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-17 10:20 +0200
                    Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-17 09:01 -0700
              Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-15 11:31 +0100
                Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-15 14:01 -0700
                  Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-15 22:28 +0100
                    Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-15 19:29 -0700
                      Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-16 10:50 +0100
                        Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-16 17:40 -0700
                          Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-16 20:22 -0700
                            Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-16 21:27 -0700
                              Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-17 01:31 -0700
                              Re: How to read a data file whose size is unknown in C? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-17 20:25 +0000
                                Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-17 16:29 -0700
                                  Re: How to read a data file whose size is unknown in C? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-17 23:43 +0000
                                    Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-17 18:20 -0700
                              Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-17 19:10 -0700
                                Re: How to read a data file whose size is unknown in C? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-18 05:26 +0000
                                  Re: How to read a data file whose size is unknown in C? raltbos@xs4all.nl (Richard Bos) - 2015-08-22 14:23 +0000
                                Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-18 04:23 -0700
                                  Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-18 17:39 -0700
                                Re: How to read a data file whose size is unknown in C? Ike Naar <ike@iceland.freeshell.org> - 2015-08-18 16:49 +0000
                                  Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-18 17:42 -0700
                                    Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-18 19:57 -0700
                                      Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-19 16:12 -0700
                                        Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-19 18:04 -0700
                                          Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-20 16:52 -0700
                                            Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-20 18:18 -0700
                                            Re: How to read a data file whose size is unknown in C? raltbos@xs4all.nl (Richard Bos) - 2015-08-21 20:39 +0000
                                              Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-21 17:17 -0700
                                                Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-21 19:35 -0700
                                                  Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-22 18:28 -0700
                                                    Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-22 22:43 -0700
                                                Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-22 00:07 -0400
                                                  Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-22 18:59 -0700
                                                    Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-22 23:22 -0400
                                                      Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-23 19:17 -0700
                                                        Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-23 21:35 -0700
                                                          Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-24 16:59 -0700
                                                            Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-24 17:57 -0700
                                                              Re: How to read a data file whose size is unknown in C? Philip Lantz <prl@canterey.us> - 2015-08-25 01:09 -0700
                                                                Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-25 19:03 -0700
                                                                  Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-25 22:16 -0400
                                                                    Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-26 14:29 -0700
                                                                      Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-26 18:28 -0400
                                                                        Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-26 19:25 -0700
                                                                          Re: How to read a data file whose size is unknown in C? David Brown <david.brown@hesbynett.no> - 2015-08-27 10:07 +0200
                                                                          Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-27 09:18 -0700
                                                                            Re: How to read a data file whose size is unknown in C? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-27 18:04 +0000
                                                                              Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-27 11:15 -0700
                                                                                Re: How to read a data file whose size is unknown in C? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-27 21:10 +0000
                                                                              Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-27 15:54 -0700
                                                                              Re: How to read a data file whose size is unknown in C? David Brown <david.brown@hesbynett.no> - 2015-08-28 09:28 +0200
                                                                            Re: How to read a data file whose size is unknown in C? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-08-27 13:12 -0600
                                                                              Re: How to read a data file whose size is unknown in C? David Brown <david.brown@hesbynett.no> - 2015-08-28 09:35 +0200
                                                              Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-25 04:28 -0700
                                                        Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-24 00:19 -0400
                                                        Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-24 00:31 -0700
                                                          Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-24 17:06 -0700
                                                Re: How to read a data file whose size is unknown in C? raltbos@xs4all.nl (Richard Bos) - 2015-08-22 14:25 +0000
                                                Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-22 10:45 -0400
                                            Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-21 17:40 -0400
                                    Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-19 00:40 -0400
                                      Re: How to read a data file whose size is unknown in C? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-19 05:38 +0000
                                        Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-19 10:20 -0400
                    Re: How to read a data file whose size is unknown in C? raltbos@xs4all.nl (Richard Bos) - 2015-08-22 14:22 +0000
            Re: How to read a data file whose size is unknown in C? raltbos@xs4all.nl (Richard Bos) - 2015-08-22 14:21 +0000
          Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-14 08:48 -0400
      Re: How to read a data file whose size is unknown in C? fl <rxjwg98@gmail.com> - 2015-08-12 16:21 -0700
        Re: How to read a data file whose size is unknown in C? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-08-12 19:44 -0600
        Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-12 22:04 -0400
      Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-13 00:44 +0100
        Re: How to read a data file whose size is unknown in C? Richard Heathfield <rjh@cpax.org.uk> - 2015-08-13 01:04 +0100
          Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-13 11:31 +0100
            Re: How to read a data file whose size is unknown in C? Richard Heathfield <rjh@cpax.org.uk> - 2015-08-13 11:51 +0100
            Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-13 08:49 -0700
              Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-13 17:45 +0100
                Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-14 11:11 +0100
                  Re: How to read a data file whose size is unknown in C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-14 11:34 +0100
                    Re: How to read a data file whose size is unknown in C? Robert Wessel <robertwessel2@yahoo.com> - 2015-08-14 12:21 -0500
                      Re: How to read a data file whose size is unknown in C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-14 19:07 +0100
                        Re: How to read a data file whose size is unknown in C? Robert Wessel <robertwessel2@yahoo.com> - 2015-08-14 16:08 -0500
                          Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-15 09:51 +0200
                            Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-15 12:36 -0700
                              Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-15 22:26 +0200
                              Re: How to read a data file whose size is unknown in C? raltbos@xs4all.nl (Richard Bos) - 2015-08-22 14:26 +0000
                                Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-22 08:11 -0700
                            Re: How to read a data file whose size is unknown in C? Robert Wessel <robertwessel2@yahoo.com> - 2015-08-16 00:05 -0500
                              Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-16 09:08 -0400
                                Re: How to read a data file whose size is unknown in C? gazelle@shell.xmission.com (Kenny McCormack) - 2015-08-16 15:22 +0000
                              Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-16 17:28 -0700
                  Re: How to read a data file whose size is unknown in C? Tonton Th <tTh@nowhere.invalid> - 2015-08-14 11:06 +0000
                  Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-14 09:28 -0700
            Re: How to read a data file whose size is unknown in C? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-13 18:56 +0000
              Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-13 13:39 -0700
              Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-14 00:21 +0100
                Re: How to read a data file whose size is unknown in C? Ian Collins <ian-news@hotmail.com> - 2015-08-14 12:26 +1200
                  Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-14 11:00 +0100
                    Re: How to read a data file whose size is unknown in C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-14 11:30 +0100
                      Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-14 12:31 +0100
                        Re: How to read a data file whose size is unknown in C? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-14 04:51 -0700
                        Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-14 09:21 -0700
                    Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-14 09:23 -0700
                      Re: How to read a data file whose size is unknown in C? David Kleinecke <dkleinecke@gmail.com> - 2015-08-14 16:57 -0700
                      Re: How to read a data file whose size is unknown in C? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-08-15 14:49 -0600
                        Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-15 19:31 -0700
                Re: How to read a data file whose size is unknown in C? Richard Heathfield <rjh@cpax.org.uk> - 2015-08-14 00:35 +0100
                Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-14 08:57 -0700
                  Re: How to read a data file whose size is unknown in C? Bartc <bc@freeuk.com> - 2015-08-14 17:28 +0100
        Re: How to read a data file whose size is unknown in C? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-13 00:12 +0000
    Re: How to read a data file whose size is unknown in C? Lőrinczy Zsigmond <nospam@for.me> - 2015-08-13 07:03 +0200
    Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-13 12:38 +0200
      Re: How to read a data file whose size is unknown in C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-13 13:32 +0100
        Re: How to read a data file whose size is unknown in C? jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-13 14:49 +0200
          Re: How to read a data file whose size is unknown in C? Richard Heathfield <rjh@cpax.org.uk> - 2015-08-13 14:05 +0100
          Re: How to read a data file whose size is unknown in C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-13 14:50 +0100
          Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-13 09:14 -0700
          Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-13 12:42 -0400
      Re: How to read a data file whose size is unknown in C? Ken Brody <kenbrody@spamcop.net> - 2015-08-13 10:56 -0400
        Re: How to read a data file whose size is unknown in C? Keith Thompson <kst-u@mib.org> - 2015-08-13 09:16 -0700
          Re: How to read a data file whose size is unknown in C? Lőrinczy Zsigmond <zsiga@nospam.for.me> - 2015-08-13 18:12 +0200
            Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-13 12:50 -0400
              Re: How to read a data file whose size is unknown in C? Lőrinczy Zsigmond <nospam@for.me> - 2015-08-13 20:07 +0200
                Re: How to read a data file whose size is unknown in C? James Kuyper <jameskuyper@verizon.net> - 2015-08-13 14:38 -0400
    Re: How to read a data file whose size is unknown in C? John Bode <jfbode1029@gmail.com> - 2015-08-13 09:30 -0700
      Re: How to read a data file whose size is unknown in C? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-14 09:03 -0700

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


#67447

Fromjacobnavia <jacob@jacob.remcomp.fr>
Date2015-08-15 09:51 +0200
Message-ID<mqmqu9$9ii$1@dont-email.me>
In reply to#67432
Le 14/08/2015 23:08, Robert Wessel a écrit :
> On Fri, 14 Aug 2015 19:07:11 +0100, Ben Bacarisse
> <ben.usenet@bsb.me.uk> wrote:
>
>> Robert Wessel <robertwessel2@yahoo.com> writes:
>>
>>> On Fri, 14 Aug 2015 11:34:25 +0100, Ben Bacarisse
>>> <ben.usenet@bsb.me.uk> wrote:
>> <snip>
>>>> On POSIX systems you can use fileno(fp) get the integer "file number"
>>> >from an open FILE *.  Presumably Windows has something similar.
>>>
>>> Not too surprisingly, on windows it's _ftell().
>>
>> Well that is a little surprising to me, maybe just because the name
>> looks like ftell.  A web search (and at least one other poster) suggest
>> _fileno is available too.
>>
>> <snip>
>
>
> *Sigh*
>
> What a brainfart...
>

This is just not true. ftell is called ftell with NO UNDERSCORE!

See
https://msdn.microsoft.com/en-us/library/0ys3hc0b.aspx

But of course the "evil empire" is always wrong by definition.

It is the norm in this group, that everything that gnu does is GREAT and 
everything that microsoft does is done by the "evil empire" then wrong.

All that by people that say themselves that they do not know windows!

Besides, lcc-win never uses the underscpre for POSIX functions. 
Microsoft does.

Etc

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


#67460

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2015-08-15 12:36 -0700
Message-ID<357fac1d-d2a8-4f59-b8e7-ec95a22d3288@googlegroups.com>
In reply to#67447
On Saturday, August 15, 2015 at 8:51:23 AM UTC+1, jacobnavia wrote:
> 
> But of course the "evil empire" is always wrong by definition.
> 
> It is the norm in this group, that everything that gnu does is GREAT and 
> everything that microsoft does is done by the "evil empire" then wrong.
> 
> All that by people that say themselves that they do not know windows!
> 
Nowadays every man and his dog has a Apple or an Android phone
(I've got three computers, an Apple Mac, a Linux box, and the one
I'm typing this at, which runs Windows) so it's dying out now.
But back in the day, most people had Windows machines, whilst a few,
usually working for big tech companies or in academia, had Unixes.
So it gave some Unix people a real sense of superiority.

I fell out of love with Microsoft when they deliberately broke
my Visual Studio 6 compiler, for which I had paid good money.
They're slowly rebuilding trust, but only slowly. But to me a 
platform is usually just a box for running algorithms and pushing 
data into and out of them. 

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


#67464

Fromjacobnavia <jacob@jacob.remcomp.fr>
Date2015-08-15 22:26 +0200
Message-ID<mqo77c$db6$1@dont-email.me>
In reply to#67460
Le 15/08/2015 21:36, Malcolm McLean a écrit :
> On Saturday, August 15, 2015 at 8:51:23 AM UTC+1, jacobnavia wrote:
>>
>> But of course the "evil empire" is always wrong by definition.
>>
>> It is the norm in this group, that everything that gnu does is GREAT and
>> everything that microsoft does is done by the "evil empire" then wrong.
>>
>> All that by people that say themselves that they do not know windows!
>>
> Nowadays every man and his dog has a Apple or an Android phone
> (I've got three computers, an Apple Mac, a Linux box, and the one
> I'm typing this at, which runs Windows) so it's dying out now.


I use the Macintosh Pro for all internet, email, Skype, whatever. I 
store all my photos in the Mac, together with all my music collection.
I use the mac obviously for all my Macintosh customers.

I use windows only for lcc-win (windows version). I have just installed 
version  10.0 of windows. I never learnt windows 8 and passed from 
version 7 to version  10. The windows machine has no internet access 
after installation, so I can develop without any Internet access, what 
makes me MUCH more productive.

And if I need to consult something, I just switch to the mac.

> But back in the day, most people had Windows machines, whilst a few,
> usually working for big tech companies or in academia, had Unixes.
> So it gave some Unix people a real sense of superiority.
>

As if using a superior system would make people using it superior.
That is the problem with that type of OS "fans". The do not see that the 
OS is just a thing like a washing machine or a freezer.

Are you a better person because your washing machine is better than the 
other guy's?

> I fell out of love with Microsoft when they deliberately broke
> my Visual Studio 6 compiler, for which I had paid good money.
> They're slowly rebuilding trust, but only slowly. But to me a
> platform is usually just a box for running algorithms and pushing
> data into and out of them.
>

I stopped windows when windows 8.0 came out. This was an insult from 
Microsoft. I remember the feeling when I got the new version of 
Microsoft Word, some 10 (or more) years ago. All the shortcuts I had 
learnt, all the things I was used to find at certain places were GONE!

The menu was gone, replaced by an unorganized stack of hundreds of 
buttons and stuff that make using Word impossible.

I had to relearn to do everything FROM SCRATCH AGAIN, I was again a 
novice. I never learned the new interface to this day.

I avoided Microsoft Word since. I came back to TeX, and in the Mac I 
have several word processing programs, all of them MUCH simpler than 
Microsoft Word.

And when I saw Windows 8.0 the same feeling of outrage came to my mind. 
I was again a novice, you have to learn everything from scratch AGAIN!!!

I avoided Windows 8.0 since. Never learnt it. Stayed with seven, that 
was quite good. Windows 10 looks VERY similar to seven and to windows as 
I remember it since windows 3.1. But now I have a Mac, customers for 
iPhone/Mac development... and microsoft looks (to me) like a company 
that now has discovered the price of arrogance, like IBM discovered that 
when the microprocessor came in and rendered the main frames rather 
obsolete...

Arrogance is expensive: it can kill a company. IBM could survive of 
course because it had many things to offer, like hardware for instance.

Now, it is Apple's time, and they will last as long as they do not 
become too arrogant.

jacob

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


#68016

Fromraltbos@xs4all.nl (Richard Bos)
Date2015-08-22 14:26 +0000
Message-ID<55d8866e.20564640@news.xs4all.nl>
In reply to#67460
Malcolm McLean <malcolm.mclean5@btinternet.com> wrote:

> I fell out of love with Microsoft when they deliberately broke
> my Visual Studio 6 compiler, for which I had paid good money.
> They're slowly rebuilding trust, but only slowly.

Really? You can't have been following the news on Windows 10 and its
oh-so-trustworthy treatment of your data and your internet connection,
then.

Richard

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


#68022

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2015-08-22 08:11 -0700
Message-ID<4fcad549-bfe6-407d-b6e2-448e45bdc82d@googlegroups.com>
In reply to#68016
On Saturday, August 22, 2015 at 3:26:42 PM UTC+1, Richard Bos wrote:
> Malcolm McLean <malcolm.mclean5@btinternet.com> wrote:
> 
> > I fell out of love with Microsoft when they deliberately broke
> > my Visual Studio 6 compiler, for which I had paid good money.
> > They're slowly rebuilding trust, but only slowly.
> 
> Really? You can't have been following the news on Windows 10 and its
> oh-so-trustworthy treatment of your data and your internet connection,
> then.
> 
Keeping my data out of the hands of the CIA isn't a priority.
Having a compiler that works and isn't crippleware is.

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


#67520

FromRobert Wessel <robertwessel2@yahoo.com>
Date2015-08-16 00:05 -0500
Message-ID<2c60ta99ncfbfjanktjqcucl2utogtt09n@4ax.com>
In reply to#67447
On Sat, 15 Aug 2015 09:51:09 +0200, jacobnavia
<jacob@jacob.remcomp.fr> wrote:

>Le 14/08/2015 23:08, Robert Wessel a écrit :
>> On Fri, 14 Aug 2015 19:07:11 +0100, Ben Bacarisse
>> <ben.usenet@bsb.me.uk> wrote:
>>
>>> Robert Wessel <robertwessel2@yahoo.com> writes:
>>>
>>>> On Fri, 14 Aug 2015 11:34:25 +0100, Ben Bacarisse
>>>> <ben.usenet@bsb.me.uk> wrote:
>>> <snip>
>>>>> On POSIX systems you can use fileno(fp) get the integer "file number"
>>>> >from an open FILE *.  Presumably Windows has something similar.
>>>>
>>>> Not too surprisingly, on windows it's _ftell().
>>>
>>> Well that is a little surprising to me, maybe just because the name
>>> looks like ftell.  A web search (and at least one other poster) suggest
>>> _fileno is available too.
>>>
>>> <snip>
>>
>>
>> *Sigh*
>>
>> What a brainfart...
>>
>
>This is just not true. ftell is called ftell with NO UNDERSCORE!
>
>See
>https://msdn.microsoft.com/en-us/library/0ys3hc0b.aspx


Actually MS is very clear that fileno(), without the underscore, is
depreciated:

https://msdn.microsoft.com/en-us/library/ms235401(v=vs.140).aspx

OTOH, they have not actually removed it from the library in quite a
few years.

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


#67524

FromJames Kuyper <jameskuyper@verizon.net>
Date2015-08-16 09:08 -0400
Message-ID<mqq1u5$5dt$1@dont-email.me>
In reply to#67520
On 08/16/2015 01:05 AM, Robert Wessel wrote:
...
> Actually MS is very clear that fileno(), without the underscore, is
> depreciated:

deprecated
-- 
James Kuyper

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


#67528

Fromgazelle@shell.xmission.com (Kenny McCormack)
Date2015-08-16 15:22 +0000
Message-ID<mqq9qq$v6u$1@news.xmission.com>
In reply to#67524
In article <mqq1u5$5dt$1@dont-email.me>,
James Kuyper  <jameskuyper@verizon.net> wrote:
>On 08/16/2015 01:05 AM, Robert Wessel wrote:
>...
>> Actually MS is very clear that fileno(), without the underscore, is
>> depreciated:
>
>deprecated

I think Robert expects a tax writeoff on it.

-- 
Modern Conservative:  Someone who  can take time  out from  flashing her
wedding ring around and bragging about  her honeymoon to complain that a
fellow secretary  who keeps a picture  of her girlfriend on  her desk is
"flauting her sexuality" and "forcing her lifestyle down our throats".

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


#67551

FromKeith Thompson <kst-u@mib.org>
Date2015-08-16 17:28 -0700
Message-ID<lny4ha7o7w.fsf@kst-u.example.com>
In reply to#67520
Robert Wessel <robertwessel2@yahoo.com> writes:
[...]
> Actually MS is very clear that fileno(), without the underscore, is
> depreciated:

Deprecated.

> https://msdn.microsoft.com/en-us/library/ms235401(v=vs.140).aspx

Which says:

    This POSIX function is deprecated. Use the ISO C++ conformant
    _fileno instead.

fileno() is declared in <stdio.h>, but is not specified by ISO C
(or C++), so a conforming implementation cannot define it there.
But POSIX defines a mechanism (defining one of several macros, such
as _POSIX_C_SOURCE) that lets fileno() be declared in <stdio.h>
without violating any ISO C rules.

Microsoft apparently has decided that using reserved names for
POSIX-like functions is a better approach -- which strikes me as
quite arrogant.  (The "P" in POSIX standard for "Portable".)

Personally I would have preferred it if *all* POSIX-specific
functions were declared in POSIX-specific headers, but POSIX had
to deal with a great deal of existing practice.

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


#67383

FromTonton Th <tTh@nowhere.invalid>
Date2015-08-14 11:06 +0000
Message-ID<slrnmsriuc.vvc.tTh@hangartistique.cispeo.fr>
In reply to#67375
On 2015-08-14, Bartc <bc@freeuk.com> wrote:

> It doesn't seem to be possible to take an active FILE* handle and use it 
> with stat(). That must be just one of the problems.

FILE *fp;
fp = fopen("foo.gif", ...
fstat(fileno(fp), ...

   works for me on a linux box...

-- 
<<<     http://la.buvette.org/photos/myrys/20ans/discours-corporate.ogg

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


#67402

FromKeith Thompson <kst-u@mib.org>
Date2015-08-14 09:28 -0700
Message-ID<lntws1al73.fsf@kst-u.example.com>
In reply to#67375
Bartc <bc@freeuk.com> writes:
[...]
> I've just tried using stat or fstat. In the case of Windows, I think
> they are called _stat and _fstat, which might be different on other OS
> (I got the idea that stat() etc are library functions, but can't find
> them in the standard).

They're not in the C standard; they're specified by POSIX.  Windows has
some support for some POSIX functions; I don't do Windows programming,
so I don't know the details.

> fstat() apparently takes an int argument, not a FILE*, which needs to
> be obtained with _open(), not fopen().
>
> While stat() takes a char* argument, not FILE*.
>
> It doesn't seem to be possible to take an active FILE* handle and use
> it with stat(). That must be just one of the problems.

When you find something that you don't know how to do, rather than
jumping to the conclusion that it's impossible and therefore the whole
thing is useless, you might consider *asking* how to do it.  In this
case there's a simple answer, which others have posted (use fileno()).

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


#67327

Fromglen herrmannsfeldt <gah@ugcs.caltech.edu>
Date2015-08-13 18:56 +0000
Message-ID<mqip8c$ka$1@speranza.aioe.org>
In reply to#67265
Bartc <bc@freeuk.com> wrote:
> On 13/08/2015 01:04, Richard Heathfield wrote:
>> On 13/08/15 00:44, Bartc wrote:
 
>>> Except the file itself could grow, shrink or be updated at the same
>>> time. Reading a file into memory could actually be impossible!

>> Right. Again, that's why this is very OS-specific. My original answer
>> was based on the assumption that the file is well-behaved and stands
>> still while you're trying to measure it.
 
> But if we're making assumptions, why not also that fseek and ftell work 
> as expected?

How do you expect them to work?
 
> We don't really want to bypass the C runtime and start using the OS 
> instead. (And I've had problems trying to use stat, fstat, _fstat, 
> fstati64 or whatever it might currently be.)
 
> If ftell/fseek work on the platforms we're interested in, and the files 
> of interest are ordinary fixed-size, static disk files, then why not use 
> them? They would be inside a getfilesize() function similar to yours anyway.

Well, the usual alternative is to read the whole file (and count), 
rewind(), then read it again. That disallows input from pipes, and 
other non-seekable devices. But then fseek()/ftell() also don't
work on pipes.

To me, input from pipes is the main reason not to use other
counting methods.

-- glen

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


#67332

FromKeith Thompson <kst-u@mib.org>
Date2015-08-13 13:39 -0700
Message-ID<lnbneac49b.fsf@kst-u.example.com>
In reply to#67327
glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:
> Bartc <bc@freeuk.com> wrote:
>> On 13/08/2015 01:04, Richard Heathfield wrote:
>>> On 13/08/15 00:44, Bartc wrote:
>  
>>>> Except the file itself could grow, shrink or be updated at the same
>>>> time. Reading a file into memory could actually be impossible!
>
>>> Right. Again, that's why this is very OS-specific. My original answer
>>> was based on the assumption that the file is well-behaved and stands
>>> still while you're trying to measure it.
>  
>> But if we're making assumptions, why not also that fseek and ftell work 
>> as expected?
>
> How do you expect them to work?

As specified by POSIX.

[...]

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


#67344

FromBartc <bc@freeuk.com>
Date2015-08-14 00:21 +0100
Message-ID<mqj8mi$n2m$1@dont-email.me>
In reply to#67327
On 13/08/2015 19:56, glen herrmannsfeldt wrote:
> Bartc <bc@freeuk.com> wrote:
>> On 13/08/2015 01:04, Richard Heathfield wrote:
>>> On 13/08/15 00:44, Bartc wrote:
>
>>>> Except the file itself could grow, shrink or be updated at the same
>>>> time. Reading a file into memory could actually be impossible!
>
>>> Right. Again, that's why this is very OS-specific. My original answer
>>> was based on the assumption that the file is well-behaved and stands
>>> still while you're trying to measure it.
>
>> But if we're making assumptions, why not also that fseek and ftell work
>> as expected?
>
> How do you expect them to work?

The same way the docs say they should? Getting back to my book analogy, 
fseek(124) will take you to page 124, and ftell() gives you the current 
page number that you're on.

This might well break down if we're trying to use the same approach with 
something like a papyrus roll, or a ticker tape, or text that has been 
tattooed on someone's body, but then it is obvious that we're not 
dealing with a book. It doesn't mean we should do away with page numbers 
and the ability to quickly flick from one location in the content to 
another, just because sometimes the thing being read is not a book.

>> If ftell/fseek work on the platforms we're interested in, and the files
>> of interest are ordinary fixed-size, static disk files, then why not use
>> them? They would be inside a getfilesize() function similar to yours anyway.
>
> Well, the usual alternative is to read the whole file (and count),
> rewind(), then read it again. That disallows input from pipes, and
> other non-seekable devices. But then fseek()/ftell() also don't
> work on pipes.
>
> To me, input from pipes is the main reason not to use other
> counting methods.

I don't know anything about pipes. Does fopen() return a handle to a 
pipe? If not, then I don't care about them. They are just something else 
that is not a file; it's some sort of stream that may or may not have 
well-defined start and end points, and may or may not be rewindable and 
may or may not be randomly accessed.

Someone mentioned the OP is trying to read or load an image file. Well 
I'm looking the details of a jpg file right now: it's 355436 bytes in 
length, it hasn't been updated since 2006, and is located on my random 
access hard drive within a Windows file system (probably NTFS).

Any reason why C's fseek and ftell functions shouldn't work on this 
file? Not just to establish the size, but to be able to do random access 
or to find out which offset in the file is going to be read on the next 
fgetc().

(Actually I'm surprised that fseek and ftell haven't been deprecated 
since they are apparently so completely useless according to the 
opinions here!)

-- 
Bartc

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


#67348

FromIan Collins <ian-news@hotmail.com>
Date2015-08-14 12:26 +1200
Message-ID<d34qu0FhbjqU1@mid.individual.net>
In reply to#67344
Bartc wrote:
> On 13/08/2015 19:56, glen herrmannsfeldt wrote:
>>
>> To me, input from pipes is the main reason not to use other
>> counting methods.
>
> I don't know anything about pipes. Does fopen() return a handle to a
> pipe? If not, then I don't care about them.

Yes, if you are using named pipes.

-- 
Ian Collins

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


#67374

FromBartc <bc@freeuk.com>
Date2015-08-14 11:00 +0100
Message-ID<mqke4h$v84$1@dont-email.me>
In reply to#67348
On 14/08/2015 01:26, Ian Collins wrote:
> Bartc wrote:
>> On 13/08/2015 19:56, glen herrmannsfeldt wrote:
>>>
>>> To me, input from pipes is the main reason not to use other
>>> counting methods.
>>
>> I don't know anything about pipes. Does fopen() return a handle to a
>> pipe? If not, then I don't care about them.
>
> Yes, if you are using named pipes.

"A named pipe is really just a special kind of file (a FIFO file) on the 
local hard drive."

OK, so we might as well throw out all the random access and file 
positioning functions, because of the off-chance than a pipe is being 
read instead of a regular file.

That makes as much sense as avoiding all random indexing into an array 
in case it might be a linked list or FIFO.

-- 
bartc

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


#67377

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2015-08-14 11:30 +0100
Message-ID<87oaiayxew.fsf@bsb.me.uk>
In reply to#67374
Bartc <bc@freeuk.com> writes:

> On 14/08/2015 01:26, Ian Collins wrote:
>> Bartc wrote:
>>> On 13/08/2015 19:56, glen herrmannsfeldt wrote:
>>>>
>>>> To me, input from pipes is the main reason not to use other
>>>> counting methods.
>>>
>>> I don't know anything about pipes. Does fopen() return a handle to a
>>> pipe? If not, then I don't care about them.
>>
>> Yes, if you are using named pipes.
>
> "A named pipe is really just a special kind of file (a FIFO file) on
> the local hard drive."
>
> OK, so we might as well throw out all the random access and file
> positioning functions, because of the off-chance than a pipe is being
> read instead of a regular file.

Why do say such things?  The fact that something does not work in all
cases does not mean that we must throw it out.  You often make these
hyperbolic remarks and I've commented before that it's more polemic than
technical discussion.  No one is suggesting we throw them out!

Random access functions are very useful, but they don't work in all
situation.  They can even be used to determine the size of a file, but
that does not work in all situations either.  If a program uses them on
its input stream, that limits the kind of input stream it can handle.
Sometimes that matters and sometimes it doesn't.  I don't see anything
problematic or controversial and these facts, but pointing them out
seems to irritate you.

<snip>
-- 
Ben.

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


#67385

FromBartc <bc@freeuk.com>
Date2015-08-14 12:31 +0100
Message-ID<mqkjg4$hhk$1@dont-email.me>
In reply to#67377
On 14/08/2015 11:30, Ben Bacarisse wrote:
> Bartc <bc@freeuk.com> writes:
>
>> On 14/08/2015 01:26, Ian Collins wrote:
>>> Bartc wrote:
>>>> On 13/08/2015 19:56, glen herrmannsfeldt wrote:
>>>>>
>>>>> To me, input from pipes is the main reason not to use other
>>>>> counting methods.
>>>>
>>>> I don't know anything about pipes. Does fopen() return a handle to a
>>>> pipe? If not, then I don't care about them.
>>>
>>> Yes, if you are using named pipes.
>>
>> "A named pipe is really just a special kind of file (a FIFO file) on
>> the local hard drive."
>>
>> OK, so we might as well throw out all the random access and file
>> positioning functions, because of the off-chance than a pipe is being
>> read instead of a regular file.
>
> Why do say such things?  The fact that something does not work in all
> cases does not mean that we must throw it out.  You often make these
> hyperbolic remarks and I've commented before that it's more polemic than
> technical discussion.  No one is suggesting we throw them out!

RH said this:

"Someone once cobbled together a bodge using fseek and ftell, which is 
not only not guaranteed to work but is actually an appalling misuse of 
those functions."

I think if it's possible to usefully employ fseek and ftell for the 
sorts of files where they do work, then what's wrong with using them to 
derive a file size in the same situation?

> Random access functions are very useful, but they don't work in all
> situation.  They can even be used to determine the size of a file, but
> that does not work in all situations either.  If a program uses them on
> its input stream, that limits the kind of input stream it can handle.
> Sometimes that matters and sometimes it doesn't.  I don't see anything
> problematic or controversial and these facts, but pointing them out
> seems to irritate you.

If I use fstat to determine the size of stdin (via fileno()), I get 0.

If make use of fseek/ftell, then I get -1. It seems to me that the 
latter is more apt, telling me that something is wrong, rather than 
being a valid file that happens to be empty.

(Something along these lines:

     p=ftell(handle);
     fseek(handle,0,2);
     size=ftell(handle);
     fseek(handle,p,0);
     return size;
)

-- 
Bartc

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


#67386

From"Rick C. Hodgin" <rick.c.hodgin@gmail.com>
Date2015-08-14 04:51 -0700
Message-ID<8ffee8d6-25b5-4ab2-8ba5-a83be7ab044e@googlegroups.com>
In reply to#67385
Windows uses:

    FILE* fh = .. ; 
    int num = _fileno(fh);

fileno() may also work. I haven't tried it.

Best regards,
Rick C. Hodgin

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


#67400

FromKeith Thompson <kst-u@mib.org>
Date2015-08-14 09:21 -0700
Message-ID<ln37zlc02v.fsf@kst-u.example.com>
In reply to#67385
Bartc <bc@freeuk.com> writes:
> On 14/08/2015 11:30, Ben Bacarisse wrote:
>> Bartc <bc@freeuk.com> writes:
[...]
>>> OK, so we might as well throw out all the random access and file
>>> positioning functions, because of the off-chance than a pipe is being
>>> read instead of a regular file.
>>
>> Why do say such things?  The fact that something does not work in all
>> cases does not mean that we must throw it out.  You often make these
>> hyperbolic remarks and I've commented before that it's more polemic than
>> technical discussion.  No one is suggesting we throw them out!
>
> RH said this:
>
> "Someone once cobbled together a bodge using fseek and ftell, which is 
> not only not guaranteed to work but is actually an appalling misuse of 
> those functions."
>
> I think if it's possible to usefully employ fseek and ftell for the 
> sorts of files where they do work, then what's wrong with using them to 
> derive a file size in the same situation?

His point is that the fseek and ftell are intended to be used for
navigating within a file.  There are other more direct ways to determine
the size of a file.

The idea that we "might as well throw out all the random access and file
positioning functions" is your own absurd invention.  Nobody has
suggested or implied that.

>> Random access functions are very useful, but they don't work in all
>> situation.  They can even be used to determine the size of a file, but
>> that does not work in all situations either.  If a program uses them on
>> its input stream, that limits the kind of input stream it can handle.
>> Sometimes that matters and sometimes it doesn't.  I don't see anything
>> problematic or controversial and these facts, but pointing them out
>> seems to irritate you.
>
> If I use fstat to determine the size of stdin (via fileno()), I get 0.

You also get information about what kind of file it is, in this case a
character device, via the st_ino member.  "man fstat" for details.

> If make use of fseek/ftell, then I get -1. It seems to me that the 
> latter is more apt, telling me that something is wrong, rather than 
> being a valid file that happens to be empty.
>
> (Something along these lines:
>
>      p=ftell(handle);
>      fseek(handle,0,2);
>      size=ftell(handle);
>      fseek(handle,p,0);
>      return size;
> )

Better to use SEEK_SET and SEEK_END for the third argument to fseek
rather than 0 and 2.

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


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