Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #67230 > unrolled thread
| Started by | fl <rxjwg98@gmail.com> |
|---|---|
| First post | 2015-08-12 15:28 -0700 |
| Last post | 2015-08-14 09:03 -0700 |
| Articles | 20 on this page of 164 — 27 participants |
Back to article view | Back to comp.lang.c
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 8 of 9 — ← Prev page 1 2 3 4 5 6 7 [8] 9 Next page →
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-08-14 09:23 -0700 |
| Message-ID | <lny4hdalfk.fsf@kst-u.example.com> |
| 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."
Where is that quote from? I don't believe it's accurate. A named pipe
lets one process write to it and another read from it, with the data
stored somewhere in the meantime. It's not necessarily stored on disk.
I actually don't know exactly how named pipes are implemented.
> 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.
Yes, it makes about as much sense, i.e., not much at all.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-08-14 16:57 -0700 |
| Message-ID | <a27b19e9-9335-4619-919f-a96d7e0dba26@googlegroups.com> |
| In reply to | #67401 |
On Friday, August 14, 2015 at 9:17:27 AM UTC-7, Keith Thompson wrote: > Bartc <bc@freeuk.com> writes: > > > > "A named pipe is really just a special kind of file (a FIFO file) on the > > local hard drive." > > Where is that quote from? I don't believe it's accurate. A named pipe > lets one process write to it and another read from it, with the data > stored somewhere in the meantime. It's not necessarily stored on disk. > I actually don't know exactly how named pipes are implemented. A pipe can be a circular buffer or it can be a nonce file. I think whoever wrote that quote was thinking of a nonce buffer that is being written at one end and read at the other. If you really have two programs running at the same time (a common experience) an explicitly circular buffer works well. I think if I were implementing general pipes I would create a rather large circular buffer - say 4096 bytes - and reallocate if it ever clogged.
[toc] | [prev] | [next] | [standalone]
| From | Joe Pfeiffer <pfeiffer@cs.nmsu.edu> |
|---|---|
| Date | 2015-08-15 14:49 -0600 |
| Message-ID | <1b37zk6zvg.fsf@pfeifferfamily.net> |
| In reply to | #67401 |
Keith Thompson <kst-u@mib.org> writes: > 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." > > Where is that quote from? I don't believe it's accurate. A named pipe > lets one process write to it and another read from it, with the data > stored somewhere in the meantime. It's not necessarily stored on disk. > I actually don't know exactly how named pipes are implemented. It would be better if he'd said it was a kind of special file (special file being Unix terminology for the object in filesystem space that's mapped to a device driver).
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-08-15 19:31 -0700 |
| Message-ID | <lnmvxs7ymy.fsf@kst-u.example.com> |
| In reply to | #67468 |
Joe Pfeiffer <pfeiffer@cs.nmsu.edu> writes:
> Keith Thompson <kst-u@mib.org> writes:
>> 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."
>>
>> Where is that quote from? I don't believe it's accurate. A named pipe
>> lets one process write to it and another read from it, with the data
>> stored somewhere in the meantime. It's not necessarily stored on disk.
>> I actually don't know exactly how named pipes are implemented.
>
> It would be better if he'd said it was a kind of special file (special
> file being Unix terminology for the object in filesystem space that's
> mapped to a device driver).
The point is that it's not (necessarily) "on the local hard drive". It
does have a directory entry, which means you can access it as if it were
an ordinary file (except that it's not seekable), but the contents are
not (necessarily) on disk.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2015-08-14 00:35 +0100 |
| Message-ID | <mqj9gp$pmh$1@dont-email.me> |
| In reply to | #67344 |
On 14/08/15 00:21, Bartc wrote: <snip> > (Actually I'm surprised that fseek and ftell haven't been deprecated > since they are apparently so completely useless according to the > opinions here!) By the same reasoning, hammers are useless because you're not supposed to use them to drive screws. The fseek and ftell functions can be invaluable. For example, imagine that you are reading a file that you can't store in memory for some reason (maybe it's too big), and you need more than one byte of lookahead (so ungetc can't help you). You use ftell to note down your position in the file, and then you go explore the next few bytes, assuming some particular variant of your file's grammar. If you then discover that the assumption was wrong, you can use fseek to get back to where you were and try the next variant. The file length trick is just a trick. It isn't what the functions were designed for. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-08-14 08:57 -0700 |
| Message-ID | <ln7foxc177.fsf@kst-u.example.com> |
| In reply to | #67344 |
Bartc <bc@freeuk.com> writes:
[...]
>> To me, input from pipes is the main reason not to use other
>> counting methods.
>
> I don't know anything about pipes.
Perhaps you should learn.
> Does fopen() return a handle to a
> pipe?
It can. Unix-like systems have *named pipes*, which have directory
entries like ordinary files and can be opened by fopen(). The POSIX
popen() function returns a FILE* referring to a pipe. The pipe()
system call creates a pipe and gives you a pair of file descriptors
(not FILE*s) referring to it. You can use fdopen() to get a FILE* from
a file descriptor, and fileno() to get a file descriptor from a FILE*.
And it's very common for stdin, stdout, and/or stderr to refer to a
pipe.
From a program's point of view, the main difference between a FILE*
referring to a pipe and a FILE* referring to an ordinary file is that
fseek() and ftell() don't work on pipes (and they cleanly report an
error if you call them).
[...]
> 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().
No reason that I can think of -- assuming you access it as a file.
But consider this. I have a jpg image file on my computer called
"albatross.jpg". The "display" command, part of ImageMagick, displays
an image on my screen. This command works:
display albatross.jpg
So does this:
cat albatross.jpg | display
(Normally that would be "display < albatross.jpg", but I wanted to show
the use of pipes clearly.)
I've mentioned elsewhere that "view /proc/stat" works, even though
/proc/stat is a pseudo-file for which the OS reports a size of 0.
On the other hand, if it's convenient to write a program that only works
if a given stream is seekable that's fine. Working correctly on pipes
can be convenient for users, but it's not mandatory.
> (Actually I'm surprised that fseek and ftell haven't been deprecated
> since they are apparently so completely useless according to the
> opinions here!)
Nobody has been saying that. We've merely been pointing out that using
fseek and ftell to determine the size of a file is not 100% reliable,
and that if a program is already using system-specific functions, it
might as well use them to determine the size of a file if it needs to.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Bartc <bc@freeuk.com> |
|---|---|
| Date | 2015-08-14 17:28 +0100 |
| Message-ID | <mql4si$j3k$1@dont-email.me> |
| In reply to | #67398 |
On 14/08/2015 16:57, Keith Thompson wrote: > Bartc <bc@freeuk.com> writes: >> Someone mentioned the OP is trying to read or load an image file. >> 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(). > > No reason that I can think of -- assuming you access it as a file. > > But consider this. I have a jpg image file on my computer called > "albatross.jpg". The "display" command, part of ImageMagick, displays > an image on my screen. This command works: > > display albatross.jpg > > So does this: > > cat albatross.jpg | display > > (Normally that would be "display < albatross.jpg", but I wanted to show > the use of pipes clearly.) This doesn't contradict anything I've been saying. Presumably, if display doesn't see any command-line arguments, then it starts looking at stdin. And if that seems like it could be the start of a JPG file, then it will try loading binary data from stdin instead of being given an explicit filename. But it is obvious that you wouldn't use seek on stdin or try to obtain its size. Although loading critical binary files files from stdin (where you might get extra carriage returns or somehow miss the EOF, or can risk hanging waiting for user input if something goes wrong) is not something I would ever attempt; it's just too crude. Using proper files though is much better, they will be better behaved and you know exactly what to expect. And with complex files, perhaps containing multiple resources, if means you might be able to read only the section of interest without just blindly processing the entire file. It's just the difference between dealing with a book, or a never-ending ticker-tape. It's possible to deal with both. -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Date | 2015-08-13 00:12 +0000 |
| Message-ID | <mqgndp$99j$1@speranza.aioe.org> |
| In reply to | #67241 |
Bartc <bc@freeuk.com> wrote: > On 12/08/2015 23:52, Richard Heathfield wrote: (snip) >> No, there is no standard way to find out the size of a file. 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. > Suppose you started to read a book but wanted to find out how many pages > you had ahead of you; what is wrong with looking at the end of the book > and glancing at the page number, then going back to the beginning? OK, but say you want to know the number of words? Not quite as easy. For a real example, IBM's z/OS keeps track of the number of disk tracks a file uses, but not how full each track is. Specifically, it doesn't know how much is (not) in the gaps between blocks. (And even more, there could be unused tracks after the end.) There is an OS call to find out the number of tracks, similar to the number of pages in a book, but not if you want the number of bytes. If you multiply by the track size, which you can also find out, you know that the file is smaller. In the case of DOS/Windows, a text file has "\r\n" line endings, but not when read in. If you count the bytes in the file, you will be a little larger than the actual number of characters to read in. >> The best way really is to keep reading it until you've read >> it, growing the storage area as you go. > Except the file itself could grow, shrink or be updated at the same > time. Reading a file into memory could actually be impossible! -- glen
[toc] | [prev] | [next] | [standalone]
| From | Lőrinczy Zsigmond <nospam@for.me> |
|---|---|
| Date | 2015-08-13 07:03 +0200 |
| Message-ID | <mqh8ea$a9q$1@speranza.aioe.org> |
| In reply to | #67230 |
On 2015.08.13. 0:28, fl wrote: > Hi, > > I had a test and I don't know what is the catch: > > How to read a data file whose size is unknown in C? Use read, fread, fgets, fgetc or similar function...
[toc] | [prev] | [next] | [standalone]
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2015-08-13 12:38 +0200 |
| Message-ID | <mqhrun$9o$1@dont-email.me> |
| In reply to | #67230 |
Le 13/08/2015 00:28, fl a écrit : > Hi, > > I had a test and I don't know what is the catch: > > How to read a data file whose size is unknown in C? > > > The data file could be a .img file. > > I thought about fseek(), etc., but I was not sure at all and didn't say > anything about it. Whether is it about some function on the end of the file? > > > Thanks, > If you use fseek to go to the end of the file, then ftell to store the size, you can get the length of the file on disc. This solution will work in the following systems: Android iOs (Apple) Linux Mac OS X All other POSIX systems Windows (all versions) MSDOS This makes for a very portable solution that can break in some odd systems. If your system is in the list above and you do not care about others just go ahead. jacob
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2015-08-13 13:32 +0100 |
| Message-ID | <87oaib4bdo.fsf@bsb.me.uk> |
| In reply to | #67266 |
jacobnavia <jacob@jacob.remcomp.fr> writes: > Le 13/08/2015 00:28, fl a écrit : <snip> >> How to read a data file whose size is unknown in C? >> >> The data file could be a .img file. >> >> I thought about fseek(), etc., but I was not sure at all and didn't say >> anything about it. Whether is it about some function on the end of the file? <snip> > If you use fseek to go to the end of the file, then ftell to store the > size, you can get the length of the file on disc. > > This solution will work in the following systems: > > Android > iOs (Apple) > Linux > Mac OS X > All other POSIX systems > Windows (all versions) > MSDOS > > This makes for a very portable solution that can break in some odd > systems. If your system is in the list above and you do not care about > others just go ahead. But it fails on most (all?) of those systems if the file is a pipe or some other kinds of special files. It's important to point that out because it can seriously harm the usefulness of a tool if can only work with seekable files. It's probably not important to the OP, but anyone using fseek to get a file's size should know all the consequences of that design. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2015-08-13 14:49 +0200 |
| Message-ID | <mqi3ko$rr7$1@dont-email.me> |
| In reply to | #67278 |
Le 13/08/2015 14:32, Ben Bacarisse a écrit : > jacobnavia <jacob@jacob.remcomp.fr> writes: > >> Le 13/08/2015 00:28, fl a écrit : > <snip> >>> How to read a data file whose size is unknown in C? >>> >>> The data file could be a .img file. >>> >>> I thought about fseek(), etc., but I was not sure at all and didn't say >>> anything about it. Whether is it about some function on the end of the file? > <snip> >> If you use fseek to go to the end of the file, then ftell to store the >> size, you can get the length of the file on disc. >> >> This solution will work in the following systems: >> >> Android >> iOs (Apple) >> Linux >> Mac OS X >> All other POSIX systems >> Windows (all versions) >> MSDOS >> >> This makes for a very portable solution that can break in some odd >> systems. If your system is in the list above and you do not care about >> others just go ahead. > > But it fails on most (all?) of those systems if the file is a pipe or > some other kinds of special files. It's important to point that out > because it can seriously harm the usefulness of a tool if can only work > with seekable files. It's probably not important to the OP, but anyone > using fseek to get a file's size should know all the consequences of > that design. > Well, that's true. So, the universally accepted advice: "Just read all the file, then you know its size" is ALSO wrong!!! You just keep reading the pipe and then... well, you can't start from scratch! Please be reasonable Ben, thanks
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2015-08-13 14:05 +0100 |
| Message-ID | <mqi4j4$c5$1@dont-email.me> |
| In reply to | #67280 |
On 13/08/15 13:49, jacobnavia wrote: > Le 13/08/2015 14:32, Ben Bacarisse a écrit : <snip> >> [...] It's probably not important to the OP, but anyone >> using fseek to get a file's size should know all the consequences of >> that design. >> > > Well, that's true. Aye. > So, the universally accepted advice: Hang on a sec - you're over-simplifying... > > "Just read all the file, then you know its size" is ALSO wrong!!! ...and yes, that advice is indeed also wrong, but it's not universally accepted advice. For one thing, you don't accept it! (And you're right not to.) But of course there are others, too, who don't accept it. Of course, the fseek/ftell method does work in many situations, and so does the "read the file and count as you go" method. But *each* of them can fail in some situations, and it's wise to know what those situations are, so that we can make a reasoned choice based on our own circumstances. The OP, for example, simply wanted to know how big a .img file is, probably on his own Windows or Linux machine. He could probably use fseek/ftell; he could probably read and count; he could almost certainly use an OS call. Any of these will probably work. The discussion has been focused not on whether these techniques will probably work but on the fact that they are not *guaranteed* to work in all situations. That, it seems to me, is a reasonable thing to point out, especially as so many people appear to think that fseek/ftell is somehow blessed as a special, magical technique - which, of course, it isn't. > You just keep reading the pipe and then... well, you can't start from > scratch! It's the wrong question. The pipe is a good metaphor, actually (although arguing from analogy is always dangerous). If I go to my kitchen sink and turn my tap (faucet, for our crosspondian cousins), water flows through the pipe and out of the tap. If I find myself asking /how much/ water might flow out, then - well, okay, it's a reasonable question for an enquiring mind to pose, but when we think it through, we realise that there is no realistic way to find out that information. > Please be reasonable Ben, thanks I think he /is/ being reasonable. But perhaps the most important point we can make here is: *however* we find out the length of the file (assuming we can), we should wrap that technique up into a function of our own, so that we don't pollute the rest of the source with code that might not work when we move the code to another platform. Let's leave ourselves with a *small* editing job, not a *huge* editing job. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2015-08-13 14:50 +0100 |
| Message-ID | <87d1yr47r7.fsf@bsb.me.uk> |
| In reply to | #67280 |
jacobnavia <jacob@jacob.remcomp.fr> writes: > Le 13/08/2015 14:32, Ben Bacarisse a écrit : >> jacobnavia <jacob@jacob.remcomp.fr> writes: >> >>> Le 13/08/2015 00:28, fl a écrit : >> <snip> >>>> How to read a data file whose size is unknown in C? >>>> >>>> The data file could be a .img file. >>>> >>>> I thought about fseek(), etc., but I was not sure at all and didn't say >>>> anything about it. Whether is it about some function on the end of the file? >> <snip> >>> If you use fseek to go to the end of the file, then ftell to store the >>> size, you can get the length of the file on disc. >>> >>> This solution will work in the following systems: >>> >>> Android >>> iOs (Apple) >>> Linux >>> Mac OS X >>> All other POSIX systems >>> Windows (all versions) >>> MSDOS >>> >>> This makes for a very portable solution that can break in some odd >>> systems. If your system is in the list above and you do not care about >>> others just go ahead. >> >> But it fails on most (all?) of those systems if the file is a pipe or >> some other kinds of special files. It's important to point that out >> because it can seriously harm the usefulness of a tool if can only work >> with seekable files. It's probably not important to the OP, but anyone >> using fseek to get a file's size should know all the consequences of >> that design. >> > > Well, that's true. > > So, the universally accepted advice: > > "Just read all the file, then you know its size" is ALSO wrong!!! > > You just keep reading the pipe and then... well, you can't start from > scratch! > > Please be reasonable Ben, thanks In what way an I being unreasonable? I tried hard to phrase what I said in the most gentle and reasonable way I could find. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-08-13 09:14 -0700 |
| Message-ID | <lnvbcjb1xa.fsf@kst-u.example.com> |
| In reply to | #67280 |
jacobnavia <jacob@jacob.remcomp.fr> writes:
> Le 13/08/2015 14:32, Ben Bacarisse a écrit :
[...]
>> But it fails on most (all?) of those systems if the file is a pipe or
>> some other kinds of special files. It's important to point that out
>> because it can seriously harm the usefulness of a tool if can only work
>> with seekable files. It's probably not important to the OP, but anyone
>> using fseek to get a file's size should know all the consequences of
>> that design.
>>
>
> Well, that's true.
>
> So, the universally accepted advice:
>
> "Just read all the file, then you know its size" is ALSO wrong!!!
>
> You just keep reading the pipe and then... well, you can't start from
> scratch!
Who says you need to start from scratch?
You can read from a pipe until you get an end-of-file indication.
With judicious use of realloc(), you can store all the data from the
pipe in an allocated array. You *can't* do the same thing by using
fstat(), or fseek/ftell. If the pipe never reports end-of-file,
hopefully you'll have some way to handle that.
Similar considerations apply to other things that act like files
but are not ordinary fixed-size disk files. For example, I can
read 1898 bytes from /proc/stat on my system, but the file system
reports its size as 0 (and fseek() appears to work without error,
but ftell() then returns 0, which is odd).
I can type "view /proc/stat" ("view" is a read-only version of
the vi/vim text editor), and it works. Apparently vim is clever
enough not to assume that either fstat or fseek/ftell reports an
accurate size.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2015-08-13 12:42 -0400 |
| Message-ID | <mqihap$igv$1@dont-email.me> |
| In reply to | #67280 |
On 08/13/2015 08:49 AM, jacobnavia wrote: ... > So, the universally accepted advice: > > "Just read all the file, then you know its size" is ALSO wrong!!! That's not universally accepted, primarily because it is, as you point out, wrong. The right solution, which is NOT universally accepted, is to accept the fact that C itself provides no solution to this problem, and look for OS-specific alternatives. "Read all of the file" might be the only thing that works on some systems, and won't work at all on others. "fseek()+ftell()" might work on some, but not others. Calling "stat()" works on all Unix-like systems, as far as I know, and similar functions exist on most operating systems that are not Unix-like. It's annoying, but the C standard is intended to implementable even on systems so peculiar that nothing equivalent to stat() could meaningfully exist on those systems. -- James Kuyper
[toc] | [prev] | [next] | [standalone]
| From | Ken Brody <kenbrody@spamcop.net> |
|---|---|
| Date | 2015-08-13 10:56 -0400 |
| Message-ID | <mqib31$pmt$1@dont-email.me> |
| In reply to | #67266 |
On 8/13/2015 6:38 AM, jacobnavia wrote: > Le 13/08/2015 00:28, fl a écrit : >> Hi, >> >> I had a test and I don't know what is the catch: [...] >> I thought about fseek(), etc., but I was not sure at all and didn't say >> anything about it. Whether is it about some function on the end of the file? [...] > If you use fseek to go to the end of the file, then ftell to store the size, > you can get the length of the file on disc. > > This solution will work in the following systems: [...] That's what I use. However, I code for the POSIX world, and not the ANSI C world, which allows me to make assumptions that ANSI C, as discussed here, would not. Maybe someone should propose comp.lang.c.posix? -- Kenneth Brody
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-08-13 09:16 -0700 |
| Message-ID | <lnr3n7b1ue.fsf@kst-u.example.com> |
| In reply to | #67299 |
Ken Brody <kenbrody@spamcop.net> writes:
> On 8/13/2015 6:38 AM, jacobnavia wrote:
[...]
>> If you use fseek to go to the end of the file, then ftell to store the size,
>> you can get the length of the file on disc.
>>
>> This solution will work in the following systems:
> [...]
>
> That's what I use. However, I code for the POSIX world, and not the ANSI C
> world, which allows me to make assumptions that ANSI C, as discussed here,
> would not.
Why don't you use stat/fstat?
> Maybe someone should propose comp.lang.c.posix?
comp.unix.programmer is probably close enough.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Lőrinczy Zsigmond <zsiga@nospam.for.me> |
|---|---|
| Date | 2015-08-13 18:12 +0200 |
| Message-ID | <mqifol$7pj$1@speranza.aioe.org> |
| In reply to | #67304 |
>> That's what I use. However, I code for the POSIX world, and not the ANSI C >> world, which allows me to make assumptions that ANSI C, as discussed here, >> would not. > > Why don't you use stat/fstat? Some possible reason: socket, pipe, character-device
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2015-08-13 12:50 -0400 |
| Message-ID | <mqihp1$k5a$1@dont-email.me> |
| In reply to | #67305 |
On 08/13/2015 12:12 PM, Lőrinczy Zsigmond wrote: >>> That's what I use. However, I code for the POSIX world, and not the ANSI C >>> world, which allows me to make assumptions that ANSI C, as discussed here, >>> would not. >> >> Why don't you use stat/fstat? > > Some possible reason: socket, pipe, character-device The st_mode field in struct stat which is filled in by calling stat()/fstat() can tell you whether one of those possibilities is relevant, so your answer sound to me like a reason FOR using stat()/fstat(), rather than AGAINST. -- James Kuyper
[toc] | [prev] | [next] | [standalone]
Page 8 of 9 — ← Prev page 1 2 3 4 5 6 7 [8] 9 Next page →
Back to top | Article view | comp.lang.c
csiph-web