Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!ccicpg!cracraft
From: cracraft@ccicpg.UUCP (Stuart Cracraft)
Newsgroups: comp.unix.wizards
Subject: scanf quiz question
Message-ID: <1220@ccicpg.UUCP>
Date: Fri, 17-Jul-87 18:51:07 EDT
Article-I.D.: ccicpg.1220
Posted: Fri Jul 17 18:51:07 1987
Date-Received: Sat, 18-Jul-87 17:15:52 EDT
Organization: CCI CPD, Irvine CA
Lines: 24

Suppose you have a line from a file such as:

str1      str2 str3 str4 ... strN    # strN+1 ... strN+I
 ^                 ^                          ^
 |                 |                          |
 Store in s1       |                          |
		   Store in s2                Store in s3

The above line consists of three fields:
   1) str1
   2) str2 ... strN (where N is up to 10)
   3) strN+1 ... strN+I (where I is up to 10)
(strX represents an arbitrary-length string, up to 20 characters.)

You want to use scanf to parse this line, storing
each of the three fields in its own variable. The obvious

   scanf("%s %[^#] %s",s1,s2,s3)

successfully parses s1 & s2, but doesn't correctly parse s3.

How do you use scanf to do it?

    Stuart