Fgets (buf, size, FP)
It acts in the following manner:
(1) returns when a newline or file end EOF is encountered.
(2) Read by row.
(3) The newline character '/n ' at the end of each line is also the line character.
(4) for buf sizes of size, read only size-1 characters.
(5) automatically fills 0 terminator ('/0 ') after the last character in the buf (usually a newline character).
So if you want to get rid of line breaks in buf, you can do this: Buf[strlen (BUF)-1] = '/0 '; The current premise is that the BUF is large enough to hold the complete line (including the last line break).
Fputs (str, FP)
(1) Enter all the text before the 0 Terminator in Str into the file.
(2) After the completion of the input, no additional special characters, such as line breaks, are added.
If you want to enter the line after STR, you should then call FPUTC (' n ', FP) after the above call;