Week15 閻覃的上課筆記
內插公式
交叉相乘
寫檔案
12FILE *fout = NULL;3fout = fopen("file.txt","w+");``w+'' Open for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the beginning of the file.
w+模式會在每次打開檔案時丟棄上次的檔案。如果想追加可以換成a+。
1fprintf(fout,"....\n");這樣在程式退出后,資料就會被寫入檔案。
如果想隨時立即寫入,需要執行以下程式碼
1fflush(fout);
沒有留言:
張貼留言