Mercurial > octave
diff liboctave/system/lo-sysdep.cc @ 25517:7fbc39a46be8
Add wrapper to fopen for files with non-ASCII chars in path on Windows (bug #49118).
* lo-sysdep.[cc/h]: Add new function "octave::sys::fopen".
* gl2ps-print.cc, gzip.cc (CFile), oct-parse.in.yy (parse_fcn_file): Replace
uses of "std::fopen" with "octave::sys::fopen".
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 29 Jun 2018 15:35:11 +0200 |
parents | 8945a6a6c0eb |
children | c2dc2fb6359b |
line wrap: on
line diff
--- a/liboctave/system/lo-sysdep.cc Fri Jun 29 12:33:09 2018 +0200 +++ b/liboctave/system/lo-sysdep.cc Fri Jun 29 15:35:11 2018 +0200 @@ -140,6 +140,17 @@ return true; } + std::FILE * + fopen (const std::string& filename, const std::string& mode) + { +#if defined (OCTAVE_USE_WINDOWS_API) + return _wfopen (u8_to_wstring (filename).c_str (), + u8_to_wstring (mode).c_str ()); +#else + return std::fopen (filename.c_str (), mode.c_str ()); +#endif + } + std::wstring u8_to_wstring (const std::string& utf8_string) { @@ -173,5 +184,6 @@ return retval; } + } }