Date: Sun, 17-Feb-85 15:16:10 EST
Posted: Sun Feb 17 15:16:10 1985
Date-Received: Tue, 19-Feb-85 07:57:27 EST
Organization: AT&T Bell Laboratories
I have been fighting an interesting but frustrating bug with
the Lattice C compiler V2.14 for the IBM-PC. The following
program distills the problem down to it's essence. It appears
that a simple sscan() is failing. When I try this same program on
UNIX SysV R2, all is well. Here's the program:
int a, b, n;
n = sscanf(" a 1 b 2 ", " a %d b %d ", &a, &b);
printf("n=%d\ta=%d\tb=%d\n", n, a, b);
It prints out the following:
n=0 a=0 b=0
What it should print out is (obviously)
n=2 a=1 b=2
If I remove the leading blanks from the first string yielding
n = sscanf("a 1 b 2 ", " a %d b %d ", &a, &b);
the program prints out:
n=2 a=1 b=0
thus failing to initialize b.
I am going to ship this off to Lifeboat and see what they say about it.
But what I need now is a quick work-around. Anybody else run into this
problem and worked around it?
Thanks in advance.