Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3217)

Unified Diff: base/file_util_posix.cc

Issue 6005: Cross-platform equivalent of fopen, _wfopen_s etc.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/file_util_posix.cc
===================================================================
--- base/file_util_posix.cc (revision 2711)
+++ base/file_util_posix.cc (working copy)
@@ -9,6 +9,7 @@
#include <fnmatch.h>
#include <fts.h>
#include <libgen.h>
+#include <stdio.h>
#include <string.h>
#include <sys/errno.h>
#include <sys/stat.h>
@@ -309,6 +310,14 @@
return true;
}
+FILE* OpenFile(const std::string& filename, const char* mode) {
+ return fopen(filename.c_str(), mode);
+}
+
+FILE* OpenFile(const std::wstring& filename, const char* mode) {
+ return fopen(WideToUTF8(filename).c_str(), mode);
+}
+
int ReadFile(const std::wstring& filename, char* data, int size) {
int fd = open(WideToUTF8(filename).c_str(), O_RDONLY);
if (fd < 0)
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_win.cc » ('j') | base/file_util_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698