From 836f134c56bfa714217ca12a73482205c1480774 Mon Sep 17 00:00:00 2001 From: "mark@chromium.org" Date: Wed, 1 Oct 2008 17:40:13 +0000 Subject: =?UTF-8?q?Cross-platform=20wrappers=20for=20fopen,=20=5Fwfopen=5F?= =?UTF-8?q?s,=20etc.=20Patch=20by=20Pawe=C3=85=E2=80=9A=20Hajdan=20jr=20.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit http://codereview.chromium.org/6005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2760 0039d316-1c4b-4281-b951-d872f2087c98 --- base/file_util.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'base/file_util.h') diff --git a/base/file_util.h b/base/file_util.h index 9d52f36..b060579 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -16,6 +16,8 @@ #include #endif +#include + #include #include #include @@ -246,6 +248,13 @@ struct FileInfo { // Returns information about the given file path. bool GetFileInfo(const std::wstring& file_path, FileInfo* info); +// Wrapper for fopen-like calls. Returns non-NULL FILE* on success. +FILE* OpenFile(const std::string& filename, const char* mode); +FILE* OpenFile(const std::wstring& filename, const char* mode); + +// Closes file opened by OpenFile. Returns true on success. +bool CloseFile(FILE* file); + // Reads the given number of bytes from the file into the buffer. Returns // the number of read bytes, or -1 on error. int ReadFile(const std::wstring& filename, char* data, int size); -- cgit v1.1