From: Walter Harms <wharms@bfs.de>
To: Arkadiusz Drabczyk <arkadiusz@drabczyk.org>,
Jakub Wilk <jwilk@jwilk.net>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>,
"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>
Subject: AW: [PATCH] fread.3: Explain that file position is moved after calling fread()/fwrite()
Date: Wed, 17 Jun 2020 07:46:25 +0000 [thread overview]
Message-ID: <3294b2a2fae14460984e2f3162f7ec35@bfs.de> (raw)
In-Reply-To: <20200616225034.e4uzibuemo7lpmet@comp.lan>
Hi,
i do not think character is correct it would confuse fseek() it says:
"The new position, measured in bytes"
to make things more complicated fread has a "size" and returns the
number of "things" read (" This number equals the number of bytes
transferred only when size is 1.").
therefor i would suggest to move the success case
> > +The file position indicator for the stream is advanced by the number
> > +of characters successfully read or written.
into the "description section"
And add a word about partial reads into the "return value" section. E.g.
to make clear what happens when you try to read size=10 while only 4 are left.
jm2c
wh
________________________________________
Von: linux-man-owner@vger.kernel.org [linux-man-owner@vger.kernel.org] im Auftrag von Arkadiusz Drabczyk [arkadiusz@drabczyk.org]
Gesendet: Mittwoch, 17. Juni 2020 00:50
An: Jakub Wilk
Cc: Michael Kerrisk; linux-man@vger.kernel.org
Betreff: Re: [PATCH] fread.3: Explain that file position is moved after calling fread()/fwrite()
On Tue, Jun 16, 2020 at 09:00:17PM +0200, Jakub Wilk wrote:
> * Arkadiusz Drabczyk <arkadiusz@drabczyk.org>, 2020-06-16, 20:26:
> > +The file position indicator for the stream is advanced by the number
> > +of characters successfully read or written.
>
> s/characters/bytes/
It says `characters' in C11 and C17
https://web.archive.org/web/20181230041359if_/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf
standards:
"Description
The fread function reads, into the array pointed to by ptr , up to
nmemb elements whose size is specified by size , from the stream
pointed to by stream . For each object, size calls are made to the
fgetc function and the results stored, in the order read, in an array
of unsigned char exactly overlaying the object. The file position
indicator for the stream (if defined) is advanced by the number of
characters successfully read. If an error occurs, the resulting value
of the file position indicator for the stream is indeterminate. If a
partial element is read, its value is indeterminate."
but indeed `bytes' sounds nicer especially if unsigned char is not
mentioned in the manpage. I sent v2.
--
Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
next prev parent reply other threads:[~2020-06-17 7:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-16 18:26 [PATCH] fread.3: Explain that file position is moved after calling fread()/fwrite() Arkadiusz Drabczyk
2020-06-16 19:00 ` Jakub Wilk
2020-06-16 22:50 ` Arkadiusz Drabczyk
2020-06-17 7:46 ` Walter Harms [this message]
2020-06-17 17:30 ` Arkadiusz Drabczyk
2020-06-18 8:37 ` AW: " Walter Harms
2020-06-18 11:43 ` Arkadiusz Drabczyk
2020-06-18 14:32 ` AW: [PATCH] fread.3: return value Walter Harms
2020-06-18 19:16 ` Arkadiusz Drabczyk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3294b2a2fae14460984e2f3162f7ec35@bfs.de \
--to=wharms@bfs.de \
--cc=arkadiusz@drabczyk.org \
--cc=jwilk@jwilk.net \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox