Skip to content
Snippets Groups Projects
Commit 17795cdd authored by David Tschumperlé's avatar David Tschumperlé
Browse files

.

parent 7ccfe79d
No related branches found
No related tags found
No related merge requests found
......@@ -6172,27 +6172,8 @@ namespace cimg_library_suffixed {
}
 
// Open a file (similar to std:: fopen(), but with wide character support on Windows).
inline std::FILE *std_fopen(const char *const path, const char *const mode) {
std::FILE *const res = std::fopen(path,mode);
if (res) return res;
#if cimg_OS==2
// Try alternative method, with wide-character string.
int err = MultiByteToWideChar(CP_UTF8,0,path,-1,0,0);
if (err) {
CImg<wchar_t> wpath(err);
err = MultiByteToWideChar(CP_UTF8,0,path,-1,wpath,err);
if (err) { // Convert 'mode' to a wide-character string.
err = MultiByteToWideChar(CP_UTF8,0,mode,-1,0,0);
if (err) {
CImg<wchar_t> wmode(err);
if (MultiByteToWideChar(CP_UTF8,0,mode,-1,wmode,err))
return _wfopen(wpath,wmode);
}
}
}
#endif
return 0;
}
inline std::FILE *std_fopen(const char *const path, const char *const mode);
 
//! Open a file.
/**
......@@ -59827,6 +59808,29 @@ namespace cimg {
#endif
}
 
// Open a file (similar to std:: fopen(), but with wide character support on Windows).
inline std::FILE *std_fopen(const char *const path, const char *const mode) {
std::FILE *const res = std::fopen(path,mode);
if (res) return res;
#if cimg_OS==2
// Try alternative method, with wide-character string.
int err = MultiByteToWideChar(CP_UTF8,0,path,-1,0,0);
if (err) {
CImg<wchar_t> wpath(err);
err = MultiByteToWideChar(CP_UTF8,0,path,-1,wpath,err);
if (err) { // Convert 'mode' to a wide-character string.
err = MultiByteToWideChar(CP_UTF8,0,mode,-1,0,0);
if (err) {
CImg<wchar_t> wmode(err);
if (MultiByteToWideChar(CP_UTF8,0,mode,-1,wmode,err))
return _wfopen(wpath,wmode);
}
}
}
#endif
return 0;
}
//! Get/set path to store temporary files.
/**
\param user_path Specified path, or \c 0 to get the path currently used.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment