Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Archive » net.micro.pc » Lattice C, V2.14, fails simply sscanf(). Why?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Lattice C, V2.14, fails simply sscanf(). Why? [message #115429] Wed, 18 September 2013 17:59
dob is currently offline  dob
Messages: 16
Registered: May 2013
Karma: 0
Junior Member
Message-ID: <158@ihu1n.UUCP>
Date: Sun, 17-Feb-85 15:16:10 EST
Article-I.D.: ihu1n.158
Posted: Sun Feb 17 15:16:10 1985
Date-Received: Tue, 19-Feb-85 07:57:27 EST
Distribution: net
Organization: AT&T Bell Laboratories
Lines: 32

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;

main()
{
	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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: RBBS in PA for public domain!
Next Topic: UCSD p-system on PC 6300
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Jul 01 15:20:11 EDT 2022

Total time taken to generate the page: 0.04254 seconds