Scanf question

Eli Messinger ebm at corvair.almaden.ibm.com
Wed Oct 10 07:21:17 AEST 1990


I'm trying to scan a formatted line that looks like:

	ccssss(tab)number(tab)number(tab)number\n

Where c are single characters, and s is a >=0 character string.

Originally I tried using the format string:

	"%c%c%s%n%n%n"

which failed, as the %s string must be blank or \n terminated.  Next
I tried:

	"%c%c%[^\t]%n%n%n"

which failed when the string was null, since the [^\t] must apparently
match at least one character for the scanf to continue.

My only solution so far is to split the scan in two, scanning the first
three and last three parameters separately (searching for the tab in
between).  Anyone have a better suggestion?  Email please.
--
		    "Hang on to your ego."  --Brian Wilson
	
      CSNET: ebm at ibm.com / UUCP: ..!uunet!ibmarc!ebm / BITNET: ebm at almaden



More information about the Comp.lang.c mailing list