[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#668581: gcc-4.6: scanf() wrong read on 08 09 integers



On Fri, Apr 13, 2012 at 09:59:11AM +0300, Teodor wrote:
> Package: gcc-4.6
> Version: 4.6.3-3
> Severity: normal
> 
> Hi,
> 
> I was debugging a more complex problem and noticed that not all
> input values were read. Further inspection showed that input
> integers "08" and "09" (read from a file) were not correctly
> recognised by fscanf() as two integers (8 and 9) but as four
> integers (0 8 0 9). I've attached a minimal test C program
> and a test file. After compile execute:
> $ ./tscanf0809 < tscanf0809.txt

It's not a bug, read the documentation about scanf and
the difference between %d and %i, which attempts to read
a number represented in octal with your input.

	Gabriel



Reply to: