The fprintf() function is used to write set of characters into file. It sends formatted output to a stream. The fscanf() function is used to read set of characters from file. It reads a word from the ...
ファイルにログを吐く処理を書いた。動いた。テストも通った。本番に出した。ファイルが空だった。 これ、笑い話じゃない。自分が実際に踏んだ穴だ。原因は単純で、`fclose`を呼んでいなかった。正確には「呼ぶのを忘れた」じゃなくて、「`fflush`も`fclose ...
// Program to write and read student records in a file using fprintf and fscanf functions. fprintf(fp, "%d %s %f\n", rollNo, name, percent); // Write record to file ...