字符串输入函数
scanf 每次只能接收一个单词,不能接收整行的输入
gets函数用于接收整行的输入,导致缓存区溢出,在新标准中C11被废弃 自动过滤换行
fgets 用于接收整行输入.传递三个参数 (数据存储的空间,读入数据最大的长度,stdin) 会输出换行
比较fgets和gets
#include <stdio.h>
#define STRLEN 225
int main()
{
char str[STRLEN] = { 0 };
while (fgets(str,str,stdin)!= NULL &&str[0]!='\n')
{
printf(str);
}
printf("Done!");
while (gets(str