输出正常,输入有问题(全1)。
void fileOut() {
FILE* fp = fopen("GRcd.txt", "wb");
fprintf(fp, "%d\n", x);
fclose(fp);
return;
}
bool fileIn() {
FILE* fp = fopen("GRcd.txt", "rb");
if (fp != NULL) {
int xx;
xx = fscanf(fp, "%d", &xx);
cout << xx << endl;
fclose(fp);
}else {
fileOut();
return 0;
}
return 1;
}