[comp.sys.amiga.tech] Lattice C v5.04 sscanf question.

robin@sabre.uucp (Robin D. Wilson/1000000) (01/18/90)

I have a question about the sscanf function in Lattice C v5.04:

Given the following line of code:

	sscanf(buf, "%s %s %d%[^\n]", str1, str2, &(int), rest_of_buf_line)

Where buf is preset to something like:

	buf = "abc def 1/3 :rest of line"


My assumption was to use the "%[^\n]" as a "read to the newline character", 
which is how it works on my UNIX box at work.

Why doesn't the sscanf routine put "/3 :rest of line" in the string variable
"rest_of_buf_line"?

This works correctly on my UNIX machine, with a relatively standard C 
compiler.

BTW, I am not terribly knowledgable in "C", so take it easy on me.



+-----------------------------------------------------------------------------+
|The views expressed herein, are the sole responsibility of the typist at hand|
+-----------------------------------------------------------------------------+
|USNail:                               UUCP:                                  |
|2323 Wells Branch Pkwy., #G107        cs.utexas.edu!romp!ibmchs!auschs\      |
|Austin, TX  78728                     !sabre.austin.ibm.com!robin            |
|Home: (512)251-6889                          ^^^^^^^^^^^^^^<-MUST BE INCLUDED|
+-----------------------------------------------------------------------------+