René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Win32_FlushToFile | ||
win32_FlushToFile.h
#ifndef WIN32_FLUSHTOFILE__ #define WIN32_FLUSHTOFILE__ #include <string> void Win32_FlushToFile(std::string const& filename, std::string const& content); #endif win32_FlushToFile.cpp
#include "win32_FlushToFile.h" #include <windows.h> void Win32_FlushToFile(std::string const& filename, std::string const& content) { DWORD dummy; HANDLE file = ::CreateFile(filename.c_str(), GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0); WriteFile(file, content.c_str(), content.size(), &dummy, 0); ::CloseHandle(file); } |