if (fp=fopen("fa.dat","r")==NULL)这样的技巧还是少用为好,编译器通常会提示Warning
另外fopen里第二个参数为r是不能写入内容的
DevC++ 4992 编译通过 运行正常
#include<stdio.h>
#include<stdlib.h>
const char * path = "D:\\\\Users\\\\MiniLight\\\\Desktop\\\\New Text Document.txt";
using namespace std;
int main(int argc, char *argv[])
{
FILE *fp;
char ch;
fp = fopen(path, "wb+");
if (fp == NULL) {
printf("Can't open this file!\\n");
exit(0);
}
do {
ch = getchar();
fputc(ch, fp);
}
while (ch != '@');
fclose(fp);
system("[s:9]AUSE");
return EXIT_SUCCESS;
}