Re: fscanf and input failure after the first conversion
- From: Geoff Clare <geoff@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 16 Jan 2009 13:23:44 +0000
Vincent Lefevre wrote:
I posted the following message to the Austin Group mailing-list about
(IMHO) a contradiction between POSIX.1-2008 and the ISO C standard.
I haven't had any answer yet,
Unlucky timing - the Austin Group discussed the issue in a conference
call yesterday (around 8 hours before your post). The group agreed
that the wording in POSIX is wrong, and that we should fix it, although
the exact change has not been finalised yet.
but I'd like to be sure that my
interpretation of the C standard is correct (in particular because
glibc seems to follow POSIX on this point[*]).
[*] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511318
That bug report seems to be about the Linux (Debian) scanf man page,
not about glibc's actual behaviour. The man page has the same
mistake as POSIX, but if you write a test program you'll find that
glibc fscanf() returns 1 for an input failure after the first
conversion, as required by the C Standard. (I used a pipe with
O_NONBLOCK set and only enough data in it for one conversion, so that
fscanf() gets an EAGAIN error when it tries to read further input).
--
Geoff Clare <netnews@xxxxxxxxxxxxx>
.
- Follow-Ups:
- Re: fscanf and input failure after the first conversion
- From: Vincent Lefevre
- Re: fscanf and input failure after the first conversion
- References:
- fscanf and input failure after the first conversion
- From: Vincent Lefevre
- fscanf and input failure after the first conversion
- Prev by Date: Re: Null terminated strings: bad or good?
- Next by Date: Re: Null terminated strings: bad or good?
- Previous by thread: fscanf and input failure after the first conversion
- Next by thread: Re: fscanf and input failure after the first conversion
- Index(es):
Relevant Pages
|