fgets fputs in C language

fgets fputs in C language

fgets() reads a string from a file

Header file: #include<stdio.h>
Function prototype: char * fgets(char * s, int size, FILE * stream)
Function description: Read a string from the file pointed to by the file pointer stream and save it to the pointer s points to In the memory space, until a newline character or the end of the file and size-1 characters have been read, the last newline character '\n' will be read (in contrast to the gets() function), an error will be read or the file will be read EOF at the end returns NULL

fputs() writes the specified string to the file stream

Header file: #include<stdio.h>
Function prototype: int fputs(char * string, FILE * stream)
Function description: Write the string pointed to by string to the file stream pointed to by stream, and return a non-negative number successfully, otherwise EOF, no will write ' \0 ' to the file

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325116718&siteId=291194637