本来想让i输出那个语句的,结果什么输出也没有,为什么?
#include <stdio.h>
int main(void) {
FILE *fp;
fp = fopen("txt.txt", "a+");
fputs("what and why", fp);
char i[99];
fgets(i, 99, fp);
printf("%s\n", i);
fclose(fp);
本来想让i输出那个语句的,结果什么输出也没有,为什么?
#include <stdio.h>
int main(void) {
FILE *fp;
fp = fopen("txt.txt", "a+");
fputs("what and why", fp);
char i[99];
fgets(i, 99, fp);
printf("%s\n", i);
fclose(fp);
关注【相关推荐】
#include <stdio.h>
int main(void)
{
char a[10] = {0};
printf("你的输入:");
fgets(a, 4, stdin);
//printf("%s\n", a);//下面这句的输出和这句是一样的
printf("printf(\"%%s\\n\", a)%c==>%s\n", ';', a);
return 0;
}