[問題] 突然回來寫C的時候發現的鬼打牆問題
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
DEV C++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
按一個數字後按ENTER 如此反覆幾次後把程式關閉
餵入的資料(Input):
預期的正確結果(Expected Output):
如按的數字依序存在TXT檔裡
錯誤結果(Wrong Output):
TXT檔裡什麼都沒有
程式碼(Code):(請善用置底文網頁, 記得排版)
int main(void)
{
FILE *inputfile;
int day;
inputfile=fopen("alin.txt","w");
while(1)
{
scanf("%d", &day);
getchar();
fprintf(inputfile,"%d\n",day);
}
fclose(inputfile);
system("pause");
return 0;
}
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.219.133.73
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1428569585.A.620.html
推
04/09 17:29, , 1F
04/09 17:29, 1F
→
04/09 17:30, , 2F
04/09 17:30, 2F
推
04/09 17:34, , 3F
04/09 17:34, 3F
推
04/09 19:37, , 4F
04/09 19:37, 4F
→
04/09 21:38, , 5F
04/09 21:38, 5F
推
04/10 11:25, , 6F
04/10 11:25, 6F
→
04/10 11:26, , 7F
04/10 11:26, 7F
→
04/10 11:37, , 8F
04/10 11:37, 8F
推
04/10 15:48, , 9F
04/10 15:48, 9F