Date: Sun, 1 May 2011 08:23:50 +0930 From: "Daniel O'Connor" <doconnor@gsoft.com.au> To: =?iso-8859-1?Q?Martin_M=F6ller?= <moeller.akt@googlemail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: [LIBC] Modfied Version of sscanf Message-ID: <6ACFC545-73B5-49FA-A97F-BC500F9AFE40@gsoft.com.au> In-Reply-To: <C9E2091B.36F%moeller.akt@googlemail.com> References: <C9E2091B.36F%moeller.akt@googlemail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 01/05/2011, at 2:14, Martin M=F6ller wrote: > outputs total garbage on my FreeBSD-7.0-RELEASE #0 amd64. > Is there already a way to do this or should we release a new version = of > sscanf, e.g. called sscanfWS. >=20 > This modified version would output: Test 2->Test 3. I think it does what it should.. %s is supposed to stop at whitespace. You probably really want.. #include <stdio.h> #include <stdlib.h> #include <sys/types.h> int main(int argc, char **argv) { char name [20], value [20]; int i; i =3D sscanf("Test 2->Test 3", "%[^-]->%[^-]", name, value); printf("%d %s->%s\n", i, name, value); exit(0); } -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6ACFC545-73B5-49FA-A97F-BC500F9AFE40>