Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #102729
| Path | csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <kst-u@mib.org> |
| Newsgroups | comp.lang.c |
| Subject | Re: Using fread function |
| Date | Sun, 29 Jan 2017 13:14:46 -0800 |
| Organization | None to speak of |
| Lines | 26 |
| Message-ID | <lnefzlbmbd.fsf@kst-u.example.com> (permalink) |
| References | <02c75a0c-84d7-4669-8bde-472730c7f8d3@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx02.eternal-september.org; posting-host="0fd733d9f8cc5cb46740a4e887498fc9"; logging-data="28711"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3pDkfCqLHlwsy1LWj+ten" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:0bzULTTeDY0e8iFBaTPheDMW6BM= sha1:YLAb2+lEOoOXG2qhf9vADdY4Bec= |
| Xref | csiph.com comp.lang.c:102729 |
Show key headers only | View raw
janus <emekamicro@gmail.com> writes:
> I just noticed that swapping the positions of the inner parameters
> does not have any material effect on result. That led me to think that
> "fread" function just multiple the two parameters.
>
> size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
>
> size_t fread(void *ptr, size_t nmemb, size_t size, FILE *stream);
>
> Is my position correct?
I wrote about this here:
http://stackoverflow.com/a/8589688/827263
Quick summary: fread() returns the number of elements it was able
to read, and the ordering of the 2nd and 3rd arguments lets you
define what an element is. Read a single data element if a partial
read is no better than not reading anything at all. Read in smaller
chunks if partial reads are useful.
--
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"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Using fread function janus <emekamicro@gmail.com> - 2017-01-29 10:07 -0800
Re: Using fread function "James R. Kuyper" <jameskuyper@verizon.net> - 2017-01-29 14:31 -0500
Re: Using fread function supercat@casperkitty.com - 2017-01-30 08:03 -0800
Re: Using fread function Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-01 13:59 -0800
Re: Using fread function jameskuyper@verizon.net - 2017-02-05 11:40 -0800
Re: Using fread function Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-08 22:04 -0800
Re: Using fread function jameskuyper@verizon.net - 2017-02-09 05:39 -0800
Re: Using fread function supercat@casperkitty.com - 2017-02-09 07:47 -0800
Re: Using fread function Keith Thompson <kst-u@mib.org> - 2017-02-09 09:19 -0800
Re: Using fread function supercat@casperkitty.com - 2017-02-09 09:55 -0800
Re: Using fread function Keith Thompson <kst-u@mib.org> - 2017-02-09 12:10 -0800
Re: Using fread function supercat@casperkitty.com - 2017-02-09 13:01 -0800
Re: Using fread function Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-12 09:36 -0800
Re: Using fread function supercat@casperkitty.com - 2017-02-12 10:52 -0800
Re: Using fread function Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-19 21:19 -0800
Re: Using fread function supercat@casperkitty.com - 2017-02-20 09:35 -0800
Re: Using fread function Keith Thompson <kst-u@mib.org> - 2017-02-20 09:52 -0800
Re: Using fread function supercat@casperkitty.com - 2017-02-20 11:15 -0800
Re: Using fread function Keith Thompson <kst-u@mib.org> - 2017-02-20 11:45 -0800
Re: Using fread function "James R. Kuyper" <jameskuyper@verizon.net> - 2017-02-20 15:38 -0500
Re: Using fread function Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-23 12:12 -0800
Re: Using fread function jameskuyper@verizon.net - 2017-02-24 10:37 -0800
Re: Using fread function Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-23 05:04 -0800
Re: Using fread function supercat@casperkitty.com - 2017-02-23 07:58 -0800
Re: Using fread function Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-25 11:48 -0800
Re: Using fread function jameskuyper@verizon.net - 2017-02-25 13:44 -0800
Re: Using fread function Tim Rentsch <txr@alumni.caltech.edu> - 2017-04-17 13:12 -0700
Re: Using fread function supercat@casperkitty.com - 2017-04-17 13:50 -0700
Re: Using fread function Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-12 09:31 -0800
Re: Using fread function Keith Thompson <kst-u@mib.org> - 2017-01-29 13:14 -0800
Re: Using fread function Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-01-30 08:18 -0800
Re: Using fread function supercat@casperkitty.com - 2017-01-30 08:44 -0800
Re: Using fread function Keith Thompson <kst-u@mib.org> - 2017-01-30 11:58 -0800
Re: Using fread function Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-01-30 13:05 -0800
Re: Using fread function supercat@casperkitty.com - 2017-01-30 13:39 -0800
Re: Using fread function Keith Thompson <kst-u@mib.org> - 2017-01-30 13:57 -0800
csiph-web