Re: fscanf and input failure after the first conversion



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>
.



Relevant Pages

  • Austin Group Frequently Asked Questions
    ... Austin Group Frequently Asked Questions ... Are there minutes available from meetings of the group? ... Technical Standard designation, and the ISO/IEC designation. ... by The Open Group on September 12 2001, as the Base Specifications, ...
    (comp.unix.programmer)
  • Austin Group Frequently Asked Questions
    ... Austin Group Frequently Asked Questions ... Are there minutes available from meetings of the group? ... Technical Standard designation, and the ISO/IEC designation. ... by The Open Group on September 12 2001, as the Base Specifications, ...
    (comp.unix.questions)
  • Austin Group Frequently Asked Questions
    ... Austin Group Frequently Asked Questions ... Are there minutes available from meetings of the group? ... Technical Standard designation, and the ISO/IEC designation. ... by The Open Group on September 12 2001, as the Base Specifications, ...
    (comp.unix.programmer)
  • Austin Group Frequently Asked Questions
    ... Austin Group Frequently Asked Questions ... Are there minutes available from meetings of the group? ... Technical Standard designation, and the ISO/IEC designation. ... The Austin Group documents specify application programming interfaces ...
    (comp.unix.programmer)
  • Re: bug in visual studio .net 2003 - breakpoints and memcpy
    ... Posix is a standard too with no less (some would say ... > platforms that support the conversion. ... Conversion between code pointers to integers does not exist for the sole ...
    (microsoft.public.win32.programmer.kernel)