C Programming - Input / Output - Discussion
Discussion Forum : Input / Output - General Questions (Q.No. 9)
9.
Out of fgets() and gets() which function is safe to use?
Answer: Option
Explanation:
Because, In fgets() we can specify the size of the buffer into which the string supplied will be stored.
Discussion:
3 comments Page 1 of 1.
Kumar said:
1 decade ago
char *fgets(char *str, int n, FILE *stream).
Parameters:
str -- This is the pointer to an array of chars where the string read is stored.
n -- This is the maximum number of characters to be read (including the final null-character). Usually, the length of the array passed as str is used.
stream -- This is the pointer to a FILE object that identifies the stream where characters are read from.
Parameters:
str -- This is the pointer to an array of chars where the string read is stored.
n -- This is the maximum number of characters to be read (including the final null-character). Usually, the length of the array passed as str is used.
stream -- This is the pointer to a FILE object that identifies the stream where characters are read from.
SagarPawar said:
8 years ago
buff means Buffer,
After fgets u can copy data to another file using fputs.
fputs(buff, ft)
Here ft is a pointer to the target file.
After fgets u can copy data to another file using fputs.
fputs(buff, ft)
Here ft is a pointer to the target file.
Raghavendra said:
8 years ago
What is buffer?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers