Hi,
I know everybody has told me to use fgets and not gets because of buffer overflow. However, I am a bit confused about the third parameter in fgets()
. As I get it, fgets is dependent on:
char * fgets ( char * str, int num, FILE * stream );
char* str
is the ptr to where my input will be stored.
num
is the max number of character to be read.
but what is FILE *stream
? If I am just prompting the user to enter a string (like a sentence) should I just type "stdin
" ?
And should I type FILE *stdin
at the top, near main()
?
Thanks, Emily