"Webster" <no***@nowhere.net> wrote in message
news:GC******************@twister01.bloor.is.net.c able.rogers.com...
"Jack Klein" <ja*******@spamcop.net> wrote in message
news:s7********************************@4ax.com...
fgets()
But what about the max number of characters to read?? How will I know
where the end of the line is??
What about you actually looking up the function Jack referred to?
Its documentation answers both of those questions:
================================================== ================
ISO/IEC 9899:1999 (E)
7.19.7.2 The fgets function
Synopsis
1 #include <stdio.h>
char *fgets(char * restrict s, int n,
FILE * restrict stream);
Description
2 The fgets function reads at most one less than the number of
characters specified by n from the stream pointed to by stream
into the array pointed to by s. No additional characters are
read after a new-line character (which is retained) or after
end-of-file. A null character is written immediately after the
last character read into the array.
Returns
3 The fgets function returns s if successful. If end-of-file is
encountered and no characters have been read into the array, the
contents of the array remain unchanged and a null pointer is
returned. If a read error occurs during the operation, the array
contents are indeterminate and a null pointer is returned.
================================================== ================
-Mike