Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!ll-xn!ames!sunybcs!ugbinns From: ugbinns@sunybcs.uucp (Leonard Binns) Newsgroups: comp.unix.wizards Subject: Re: scanf quiz winner!!!! Message-ID: <4340@sunybcs.UUCP> Date: Thu, 30-Jul-87 21:15:22 EDT Article-I.D.: sunybcs.4340 Posted: Thu Jul 30 21:15:22 1987 Date-Received: Sat, 1-Aug-87 11:30:04 EDT Sender: nobody@sunybcs.UUCP Reply-To: ugbinns@marvin.UUCP (Leonard Binns) Distribution: na Organization: SUNY/Buffalo Computer Science Lines: 34 Summary: What is your ruling Stuart? In article <8530@brl-adm.ARPA> franco@MIKEY.BBN.COM (Frank A. Lonigro) writes: > Sorry!! But your winner is a loser!!! {|-)> I don't think so Frank! > The scanf line that was exclaimed to be a winner once again >restricts the character strings to not have a certain char in them >in this case a 'newline' (\n). This example follows: > scanf("%s %[^#] %*c %[^\n]", s1, s2, s3); I look at this as a *feature* not a drawback! I assumed that the newline was the final delimeter in the third string. This makes more sense (to me) than your solution since mine can be used to scan more than *one* set of input during execution. In your solution, the final delimeter for the third string is EOF, which makes scanning more than one input line difficult to say the least. > I have stated the correct way to handle the problem in a >recent posting to unix-wizards. That example follows: > scanf("%s %[^#] %*c %[\001-\177]", s1, s2, s3); > ^^^^^^^^^ >Please note that the format string doesn't restrict any chars from >appearing in the final string except the NULL. > >franco%bbn.com@relay.cs.net Well if you find it more useful to be able to only scan *one* set of input, more power to you. And before you jump the gun I think you really should get your facts straight before you denounce someone so positively. Did you? :-| Stuart, what's your ruling?? -Len Binns