From: rnv Date: Wed, 13 Mar 2019 08:17:57 +0000 (+0300) Subject: Fix for "54515: [FORUM] MED export issue" issue. X-Git-Tag: V9_3_0b1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=dce0afd0a6c283476bb9a792f1892faee0d059b9;hp=eb9d56943a8cd1608862e4e87953ebca0815e0f1;ds=sidebyside Fix for "54515: [FORUM] MED export issue" issue. --- diff --git a/src/MEDWrapper/MED_Factory.cxx b/src/MEDWrapper/MED_Factory.cxx index 6f5103994..12c0f597a 100644 --- a/src/MEDWrapper/MED_Factory.cxx +++ b/src/MEDWrapper/MED_Factory.cxx @@ -24,6 +24,8 @@ #include "MED_Utilities.hxx" #include "MED_Wrapper.hxx" +#include + #include #include #include @@ -77,11 +79,22 @@ bool CreateEmptyMEDFile(const std::string& fileName, int version) MESSAGE("create an empty med file of the right version, for append " << version); static const unsigned char empty_32[] = EMPTY_FILE_32; static const unsigned char empty_33[] = EMPTY_FILE_33; +#ifdef WIN32 +#ifdef UNICODE + std::wstring aFilename = Kernel_Utils::utf8_decode_s(fileName); +#else + std::wstring aFilename = fileName; +#endif + std::ofstream ofs(aFilename, std::ios::binary); +#else std::ofstream ofs(fileName); +#endif if (version == 32) ofs.write(reinterpret_cast(empty_32),sizeof(empty_32)); else if (version == 33) ofs.write(reinterpret_cast(empty_33),sizeof(empty_33)); + ofs.flush(); + ofs.close(); return true; } // -------------------------------------------------------------------------------------------------------------------