Date: Fri, 18 Sep 1998 11:20:03 -0700 (PDT) From: Jin Guojun (ITG staff) <jin@george.lbl.gov> To: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/7970: Bug in *scanf: %n is sometimes ignored. Message-ID: <199809181820.LAA00404@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/7970; it has been noted by GNATS.
From: Jin Guojun (ITG staff) <jin@george.lbl.gov>
To: freebsd-gnats-submit@FreeBSD.ORG, nialls@euristix.ie
Cc: Subject: Re: bin/7970: Bug in *scanf: %n is sometimes ignored.
Date: Fri, 18 Sep 1998 07:07:22 -0700 (PDT)
> The following code demonstrates the bug:
>
> #include <stdio.h>
>
> int
> main()
> {
> int i;
> int n = 12345678;
>
> sscanf("24\n", "%li %n", &i, &n);
>
> printf("%d %d\n", i, n);
>
> return 0;
> }
>
> The output should be "4 2", but it is "4 12345678"; n is not
> ...
The output should be "24 3", you have 3 bytes in the stream and the first
"%li" is 24. If you got "4 2", then it is completely wrong somewhere.
-Jin
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809181820.LAA00404>
