Writing File or fputs() function
The fputs() function writes a line of characters into file. It outputs string to a stream.C fputs function is implemented in file related programs for writing string to any particular file.
In this function returns non-negative value, otherwise returns EOF on error.
Syntax: fputs(const char *s, FILE *stream)
Example:
Reading File or fgets() function
The fgets() function reads a line of characters from file. It gets string from a stream.C fgets function is implemented in file related programs for reading strings from any particular file. It gets the strings 1 line each time.
Syntax: char* fgets(char *s, int n, FILE *stream)
Return:-
1)On success, the function returns the same str parameter
2)C fgets function returns a NULL pointer in case of a failure.
Example:
""Share it""
Comments
Post a Comment