[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Problems with scanf_P()
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] Problems with scanf_P() |
Date: |
Fri, 16 Jul 2004 10:16:00 +0200 (MET DST) |
"Larry Barello" <address@hidden> wrote:
> Problem solved: I wasn't flushing the input stream after a bad
> conversion.
> Replacing "%d%c%c%d" with "%d%c%c%d%*s" solved the problem. The %*s
> eats the rest of the input line and flushes extra, bogus characters.
I tend to not use scanf() directly from a stream for reasons like this
one, but rather read a line from the stream, and use sscanf() on the
buffer.
--
J"org Wunsch Unix support engineer
address@hidden http://www.interface-systems.de/~j/