Question regarding fgets and new lines
- From: mellyshum123@xxxxxxxx
- Date: 23 Nov 2006 19:34:00 -0800
I need to read in a comma separated file, and for this I was going to
use fgets. I was reading about it at http://www.cplusplus.com/ref/ and
I noticed that the document said:
"Reads characters from stream and stores them in string until (num -1)
characters have been read or a newline or EOF character is reached,
whichever comes first."
My question is that if it stops at a new line character (LF?) then how
does one read a file with multiple new line characters?
Another question. The syntax is:
char * fgets (char * string , int num , FILE * stream);
but you have to allot a size for the string before this. Would you just
use the same num as used in the fgets? So char stringexample[num] ?
.
- Follow-Ups:
- Re: Question regarding fgets and new lines
- From: Bill Reid
- Re: Question regarding fgets and new lines
- From: websnarf
- Re: Question regarding fgets and new lines
- From: Eric Sosman
- Re: Question regarding fgets and new lines
- From: Peter Nilsson
- Re: Question regarding fgets and new lines
- From: Clark S. Cox III
- Re: Question regarding fgets and new lines
- Prev by Date: Re: Interesting code
- Next by Date: Re: Question regarding fgets and new lines
- Previous by thread: Re: I AM SO SEXY COME NAD GET ME:))
- Next by thread: Re: Question regarding fgets and new lines
- Index(es):
Relevant Pages
|
|