summaryrefslogtreecommitdiffstats
path: root/base/file_util.h
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-01 17:40:13 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-01 17:40:13 +0000
commit836f134c56bfa714217ca12a73482205c1480774 (patch)
tree5c5b9d938a712e09831bdd32022e1b3716c5fbdf /base/file_util.h
parentd46d6f3b80099ce0c630185a2e86b649bba49254 (diff)
downloadchromium_src-836f134c56bfa714217ca12a73482205c1480774.zip
chromium_src-836f134c56bfa714217ca12a73482205c1480774.tar.gz
chromium_src-836f134c56bfa714217ca12a73482205c1480774.tar.bz2
Cross-platform wrappers for fopen, _wfopen_s, etc.
Patch by Paweł Hajdan jr <phajdan.jr@gmail.com>. http://codereview.chromium.org/6005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2760 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.h')
-rw-r--r--base/file_util.h9
1 files changed, 9 insertions, 0 deletions
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 <fts.h>
#endif
+#include <stdio.h>
+
#include <stack>
#include <string>
#include <vector>
@@ -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);