/****************************************************************************
* OUVERTURE DU FICHIER EN LECTURE *
****************************************************************************/
+#if defined(WIN32) && defined(UNICODE)
+ std::wstring file2Read = Kernel_Utils::utf8_decode_s(myFile);
+ FILE* aFileId = _wfopen(file2Read.c_str(), L"r");
+#else
char *file2Read = (char *)myFile.c_str();
FILE* aFileId = fopen(file2Read, "r");
+#endif
if ( !aFileId ) {
fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
return DRS_FAIL;
Status aResult = DRS_OK;
int nbNodes, nbCells;
+#if defined(WIN32) && defined(UNICODE)
+ std::wstring file2Read = Kernel_Utils::utf8_decode_s(myFile);
+ FILE* aFileId = _wfopen(file2Read.c_str(), L"w+");
+#else
char *file2Read = (char *)myFile.c_str();
FILE* aFileId = fopen(file2Read, "w+");
+#endif
if ( !aFileId )
{
fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
#include <math.h>
#include <ctype.h>
#include "libmesh5.h"
-
+#ifdef WIN32
+#include <windows.h>
+#endif
/*----------------------------------------------------------*/
/* Defines */
GmfMshSct *msh;
char *ptr;
int k;
-
+#if defined(WIN32) && defined(UNICODE)
+ wchar_t* encoded = 0;
+ int size_needed = 0;
+#endif
if(!GmfIniFlg)
{
for(i=0;i<=MaxMsh;i++)
va_end(VarArg);
/* Create the name string and open the file */
-
- if(!(msh->hdl = fopen(msh->FilNam, "rb")))
+#if defined(WIN32) && defined(UNICODE)
+ size_needed = MultiByteToWideChar(CP_UTF8, 0, msh->FilNam, strlen(msh->FilNam), NULL, 0);
+ encoded = malloc((size_needed + 1)*sizeof(wchar_t));
+ MultiByteToWideChar(CP_UTF8, 0, msh->FilNam, strlen(msh->FilNam), encoded, size_needed);
+ encoded[size_needed] = '\0';
+ if (!(msh->hdl = _wfopen(encoded, L"rb")))
+#else
+ if (!(msh->hdl = fopen(msh->FilNam, "rb")))
+#endif
{
free (msh);
+#if defined(WIN32) && defined(UNICODE)
+ free(encoded);
+#endif
return(0);
}
+#if defined(WIN32) && defined(UNICODE)
+ free(encoded);
+#endif
+
/* Read the endian coding tag, the mesh version and the mesh dimension (mandatory kwd) */
if(msh->typ & Bin)
}
/* Create the mesh file */
-
+#if defined(WIN32) && defined(UNICODE)
+ size_needed = MultiByteToWideChar(CP_UTF8, 0, msh->FilNam, strlen(msh->FilNam), NULL, 0);
+ encoded = malloc((size_needed + 1) * sizeof(wchar_t));
+ MultiByteToWideChar(CP_UTF8, 0, msh->FilNam, strlen(msh->FilNam), encoded, size_needed);
+ encoded[size_needed] = '\0';
+ if (!(msh->hdl = _wfopen(encoded, L"wb")))
+#else
if(!(msh->hdl = fopen(msh->FilNam, "wb")))
+#endif
{
free (msh);
+#if defined(WIN32) && defined(UNICODE)
+ free(encoded);
+#endif
return(0);
}
+#if defined(WIN32) && defined(UNICODE)
+ free(encoded);
+#endif
GmfMshTab[ MshIdx ] = msh;
theFile.close();
// Open the file
- FILE* file = fopen( myFile.c_str(),"r");
+#if defined(WIN32) && defined(UNICODE)
+ std::wstring aFile = Kernel_Utils::utf8_decode_s(myFile);
+ FILE* file = _wfopen( aFile.c_str(), L"r");
+#else
+ FILE* file = fopen(myFile.c_str(), "r");
+#endif
// count the number of lines
Standard_Integer nbLines = 0;