Why does ofstream require a flush?
问题 If I run the following code, no file is created at all: std::ofstream outputFile(strOutputLocation.c_str(), std::ios::binary); outputFile.write((const char*)lpResLock, dwSizeRes); outputFile.close(); However, if I add a flush() before the close, it works: std::ofstream outputFile(strOutputLocation.c_str(), std::ios::binary); outputFile.write((const char*)lpResLock, dwSizeRes); outputFile.flush(); outputFile.close(); Does the standard library actually require this, or is it a bug in the Visual