i****d 发帖数: 255 | 1 Hi, I have a question about the fprintf in C\C++. Usually we open a file
with fopen,
write data to that file with fprintf. Before we close the file, however, we
may see that the date file is essentially empty, meaning that the program
just wrote the data to some buffer, instead directly wrote them to the hard
driver. So my question is:
is there any function which would force fprintf write data to hard driver at
the real time or with the minimum delay?
Many thanks! | a***s 发帖数: 614 | 2 No, it is controlled by OS. | T*******i 发帖数: 4992 | 3 fflush
we
hard
at
【在 i****d 的大作中提到】 : Hi, I have a question about the fprintf in C\C++. Usually we open a file : with fopen, : write data to that file with fprintf. Before we close the file, however, we : may see that the date file is essentially empty, meaning that the program : just wrote the data to some buffer, instead directly wrote them to the hard : driver. So my question is: : is there any function which would force fprintf write data to hard driver at : the real time or with the minimum delay? : Many thanks!
| n********a 发帖数: 119 | 4 set fflush as NULL
man fflush
【在 a***s 的大作中提到】 : No, it is controlled by OS.
|
|