Changeset 374 for cpp/common
- Timestamp:
- 04/23/15 03:18:25 (10 years ago)
- Location:
- cpp/common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/nonstd_stdio.cpp
r372 r374 18 18 #endif 19 19 20 21 22 #ifdef _WIN32 23 FILE* mfile_wfopen(const char *path, const char *mode) //to avoid converting args into wide char in all occurrences of mfopen() 24 { 25 return _wfopen(Convert::utf8ToUtf16(path).c_str(), Convert::strTOwstr(mode).c_str()); 26 } 27 #endif 28 20 29 bool fileExists(const char* path) 21 30 { 22 31 //lepiej gdyby uzywalo stat bo mfopen mogloby cos niepotrzebnie wczytywac przy otwarciu pliku ale mfopen wiadomo ze zadziala wszedzie tak samo 23 #ifdef _WIN3224 MFILE *f = mfopen(Convert::utf8ToUtf16(path).c_str(), Convert::strTOwstr(FOPEN_READ_BINARY).c_str());25 #else26 32 MFILE *f = mfopen(path, FOPEN_READ_BINARY); 27 #endif28 33 if (f == NULL) return false; 29 34 mfclose(f); … … 105 110 { 106 111 int size; 107 #ifdef _WIN32108 MFILE *f = mfopen(Convert::utf8ToUtf16(path).c_str(), Convert::strTOwstr(FOPEN_READ_BINARY).c_str());109 #else110 112 MFILE *f = mfopen(path, FOPEN_READ_BINARY); 111 #endif112 113 if (f == NULL) return -1; 113 114 size = getFileSize(f); -
cpp/common/nonstd_stdio.h
r295 r374 79 79 typedef FILE MFILE; 80 80 #ifdef _WIN32 81 #define mfopen _wfopen 81 FILE* mfile_wfopen(const char *path, const char *mode); 82 #define mfopen mfile_wfopen 82 83 #else 83 84 #define mfopen fopen -
cpp/common/stl-util.cpp
r372 r374 92 92 #endif 93 93 { 94 #ifdef _WIN3295 MFILE *f = mfopen(Convert::utf8ToUtf16(filename).c_str(), Convert::strTOwstr(FOPEN_READ_BINARY).c_str());96 #else97 94 MFILE *f = mfopen(filename, FOPEN_READ_BINARY); 98 #endif99 95 if (f) 100 96 { … … 124 120 bool writeCompleteFile(const char* filename, const string& text, bool warn_on_fail) 125 121 { 126 #ifdef _WIN32127 MFILE *f = mfopen(Convert::utf8ToUtf16(filename).c_str(), Convert::strTOwstr(FOPEN_WRITE_BINARY).c_str());128 #else129 122 MFILE *f = mfopen(filename, FOPEN_WRITE_BINARY); 130 #endif131 123 bool ok = f != NULL; 132 124 if (f)
Note: See TracChangeset
for help on using the changeset viewer.