I have a C++ program that is writing to a file on Windows 7. When I call f.flush() the NTFS file does not get bigger. Is there any way to force the file to get flushed?
I have a C++ program that is writing to a file on Windows 7.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can look here:
How do I get the file HANDLE from the fopen FILE structure?
the code looks like this:
do not forget call fflush(file), before call FlusFileBuffers.
For std::fstream and gnu stl, I checked it on my linux box, have no windows at home,
but should work with mingw, may be need some modifications: