Chromium Code Reviews| Index: base/file_util_win.cc |
| =================================================================== |
| --- base/file_util_win.cc (revision 2711) |
| +++ base/file_util_win.cc (working copy) |
| @@ -447,6 +447,24 @@ |
| return true; |
| } |
| +FILE* OpenFile(const std::string& filename, const char* mode) { |
| + std::wstring w_mode = ASCIIToWide(std::string(mode)); |
|
Mark Mentovai
2008/10/01 17:40:55
Not for fopen_s, you can just pass mode directly.
|
| + FILE* file; |
| + if (fopen_s(&file, filename.c_str(), w_mode.c_str()) != 0) { |
| + return NULL; |
| + } |
| + return file; |
| +} |
| + |
| +FILE* OpenFile(const std::wstring& filename, const char* mode) { |
| + std::wstring w_mode = ASCIIToWide(std::string(mode)); |
| + FILE* file; |
| + if (_wfopen_s(&file, filename.c_str(), w_mode.c_str()) != 0) { |
| + return NULL; |
| + } |
| + return file; |
| +} |
| + |
| int ReadFile(const std::wstring& filename, char* data, int size) { |
| ScopedHandle file(CreateFile(filename.c_str(), |
| GENERIC_READ, |