fgets, fputs, ferror, feof, stdin, stdout, EOF, fopen, fclose, fgetc, fputc, getchar, putchar

扶醉桌前 提交于 2019-12-29 14:33:25
 注意区分gets, fgets, fgetc, getc, getcharputs, fputs, fputc, putc, putchar fgets function<cstdio>char * fgets ( char * str, int num, FILE * stream );

Get string from stream

Reads characters from stream and stores them as a C string into str until (num-1) characters have been read or either a newline or a the End-of-File is reached, whichever comes first.
A newline character makes fgets stop reading, but it is considered a valid character and therefore it is included in the string copied to str.
A null character is automatically appended in str after the characters read to signal the end of the C string.
 
fputsfunction<cstdio>int fputs ( const char * str, FILE * stream );

Write string to stream

Writes the string pointed by str to the stream.
The function begins copying from the address specified (str) until it reaches the terminating null character ('\0'). This final null-character is not copied to the stream.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!