Mail Archives: djgpp/2000/05/02/11:18:13
On Tue, 02 May 2000 05:30:49 +0000, "nimrod a. abing"
<synflood AT eudoramail DOT com> wrote:
[snipped most of source code]
>> //here is the place to read in added and counted
>
>Hmmm... judging from your comments, you're using C++.
Or C9x, which GCC partially supports. One of the new features of the
C99 standard is single-line comments, something it borrowed from the
C++ language.
>Or have tried replacing `fread' with `fscanf'? It
>works just like `scanf' only it works with *open*
>files. `scanf("%d", %data)' is also
>`fscanf(stdin, "%d", &data)'. `fread' is best used
>for reading in large chunks of a file opened in
>binary mode. In your case, `fscanf' would work since
>your separators are newlines.
scanf() and fscanf() introduce buffer overflow errors.
I'd suggest fgets() with sscanf().
--
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html
This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses. http://www.mcafee.com/
- Raw text -