Date: Wed, 15 Jan 1997 07:38:35 -0800 (PST) From: scrutchfield@ifusion.com To: freebsd-gnats-submit@freebsd.org Subject: bin/2502: Unable to sscanf first integer value. Message-ID: <199701151538.HAA07065@freefall.freebsd.org> Resent-Message-ID: <199701151540.HAA07190@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 2502 >Category: bin >Synopsis: Unable to sscanf first integer value. >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jan 15 07:40:01 PST 1997 >Last-Modified: >Originator: Steven M. Crutchfield >Organization: IFusionCom >Release: 2.2-BETA >Environment: FreeBSD no_dobbs.ifusion.com 2.2-BETA_A FreeBSD 2.2-BETA_A #0: Tue Jan 7 16:05:22 EST 1997 root@no_dobbs.ifusion.com:/usr/src/sys/compile/PS2MOUSE i386 >Description: I am unable to sscanf correctly 2 integers from a string. A Sample program that recreates the problem is shown below. This is a problem in both libc and libc_r. #include <stdio.h> #include <string.h> #include <stdlib.h> main() { char *tmp = "999 12346"; char *ptr; unsigned short x; unsigned short y; unsigned short z; unsigned int a; int result; result = sscanf ( tmp, "%d %d", &x, &y ); z = strtol ( tmp, &ptr, 0 ); a = atoi ( tmp ); (void)fprintf ( stderr, "x(%d)y(%d)z(%d)a(%d)\n", x, y, z, a ); exit ( 0 ); } >How-To-Repeat: Run the above program. >Fix: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701151538.HAA07065>