Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: fread a file of unknown size |
| Date | 2015-03-08 18:21 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <mdii07$6i0$1@dont-email.me> (permalink) |
| References | <mdi5g9$9hc$1@reader1.panix.com> <mdi64b$jpi$1@dont-email.me> |
On 03/08/2015 02:59 PM, Richard Heathfield wrote: > On 08/03/15 18:47, ruben safir wrote: >> if you use fread to read a file of unknown size with a set buffer size >> of say 500 bytes, when you get to the end of the file you are likely to >> read a stub of 500 bytes of info and the eof marker. >> >> And fread will not red that block > > fread ought to return the number of bytes read. Instead, it returns the > number of blocks. I expect there was a good reason once. I gather that there are systems, or at least particular devices on some systems, where the number of bytes read will always be a multiple of a block size characteristic of that device. Even on systems where that is not true, if the file I'm reading has a fixed record size, a valid read from an undamaged file will always read in an integer number of records, so it still makes sense. -- James Kuyper
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
fread a file of unknown size ruben safir <ruben@mrbrklyn.com> - 2015-03-08 14:47 -0400
Re: fread a file of unknown size Richard Heathfield <rjh@cpax.org.uk> - 2015-03-08 18:59 +0000
Re: fread a file of unknown size James Kuyper <jameskuyper@verizon.net> - 2015-03-08 18:21 -0400
Re: fread a file of unknown size Keith Thompson <kst-u@mib.org> - 2015-03-08 18:43 -0700
Re: fread a file of unknown size fmassei@gmail.com - 2015-03-08 15:41 -0700
Re: fread a file of unknown size raltbos@xs4all.nl (Richard Bos) - 2015-03-10 16:04 +0000
Re: fread a file of unknown size Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-03-08 18:44 -0400
Re: fread a file of unknown size jacob navia <jacob@spamsink.net> - 2015-03-08 20:32 +0100
Re: fread a file of unknown size Keith Thompson <kst-u@mib.org> - 2015-03-08 12:48 -0700
Re: fread a file of unknown size glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-03-08 23:39 +0000
Re: fread a file of unknown size James Kuyper <jameskuyper@verizon.net> - 2015-03-08 20:40 -0400
Re: fread a file of unknown size glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-03-09 01:24 +0000
Re: fread a file of unknown size Keith Thompson <kst-u@mib.org> - 2015-03-09 07:53 -0700
Re: fread a file of unknown size glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-03-09 17:36 +0000
Re: fread a file of unknown size Keith Thompson <kst-u@mib.org> - 2015-03-09 10:44 -0700
Re: fread a file of unknown size glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-03-09 20:07 +0000
csiph-web