Path: utzoo!attcan!uunet!decwrl!shelby!csli!poser From: poser@csli.Stanford.EDU (Bill Poser) Newsgroups: comp.lang.c Subject: Re: Problems with scanf() Message-ID: <16070@csli.Stanford.EDU> Date: 27 Oct 90 20:26:29 GMT References: <1990Oct12.154156.25096@murdoch.acc.Virginia.EDU> <1990Oct20.001637.28244@unislc.uucp> <324@brat.UUCP> Reply-To: poser@csli.stanford.edu (Bill Poser) Distribution: na Organization: Center for the Study of Language and Information, Stanford U. Lines: 8 I don't see why it is necessary to worry about scanf(). It is safe to use directly only when you are quite sure of the input format, which is not very often. But you can use its parsing facilities safely by reading input using a safe getline function (I often use one that strips comments and allows quoting of newlines in place of one that merely counts input characters to prevent overflowing the buffer) and then using sscanf(). Except for one-shot programs I suggest avoiding fscanf() altogether and using sscanf plus a safe input function.