[gccsdk] Different behaviour between scl and unixlib

Ralph Corderoy ralph at inputplus.co.uk
Mon Sep 27 16:38:56 PDT 2010


Hi Jan-Jaap,

>   while ((read = fscanf(file, "%10[^\n]%c", buffer, &lastchar)) != EOF)

fscanf(3) here says %[ matches a non-empty sequence.  That matches the
behaviour I see on Linux, no gccsdk involved.

    $ printf 'foo\nbar\n\nxyz\n' | ./fscanf | sed 4q
    read: 2: 'foo', lastchar = 10
    read: 2: 'bar', lastchar = 10
    read: 0: 'bar', lastchar = 10
    read: 0: 'bar', lastchar = 10
    $ 

Cheers,
Ralph.





More information about the gcc mailing list