#include
#include
// #pragma warning(disable:4996)
const int MAXLEN = 1000;
int main() {
char s[MAXLEN]; // = {0};
// memset(s, 0, sizeof(s)); // s要被多次使用的
FILE *p = fopen("E:\\输入信息得文本.txt", "w");
if(p == NULL) {
printf("不能打开文件。\n");
return 1;
}
while (1) {
//gets(s);
fgets(s,MAXLEN,stdin);
// fgtes()函数读取的串中通常含有'\n'
int len = strlen(s);
if(s[len - 1] == '\n') s[len - 1] = '\0';
if (strcmp(s,"exit") == 0) break;
fprintf(p,"%s\n",s);
}
fclose(p);
printf("end\n");
return 0;
}