BWAPI
|
00001 #pragma once 00002 #include <windows.h> 00003 #include <string> 00004 00005 class FileWriter 00006 { 00007 public: 00008 FileWriter(); 00009 ~FileWriter(); 00010 bool Open(const char *pszFilename); 00011 bool Error(const char *pszText = NULL); 00012 void Close(); 00013 template <class _T> 00014 void Write(_T val) 00015 { 00016 DWORD written; 00017 WriteFile(this->hFile, &val, sizeof(_T), &written, NULL); 00018 } 00019 void WriteRaw(void *pData, size_t size); 00020 void Write7BitEncodedInt(int value); 00021 void WriteString(std::string str); 00022 private: 00023 HANDLE hFile; 00024 }; 00025