user3462791
user3462791

Reputation: 43

opening filename containing Unicode characters in VC6 compiler

We have a maintainance project that was build on VC6 compilers. At some part of the code we have a file open function using ifstream.open() method which fails when the filename contains UNICODE characters like chinese characters. Since VC6 compiler doesn't support the wchar_t* version of open function, is there a way i can open this type of file? i tried FILE* _wfopen method too but it fails too.

Thanks in advance

As per RemyLebeau's guidance - i tried using errno,i got the value as 22 which indicates invalid parameter. Plese see my code std::wstring filename=_wgetenv(L"IVT_FILENAME"); FILE * stream; stream=_wfopen(filename.c_str(),L"r");

This works perfectly fine in vc9 and file opens and im able to read contents. Don't know why it doesnt work in vc6. The value of stream is NULL

Upvotes: 0

Views: 376

Answers (1)

user3462791
user3462791

Reputation: 43

The actual problem was with _wgetenv function. It doesnot work properly in VC6 compiler. Replacing it with GetEnvironmentVariable solves the issue and file is opened

Upvotes: 0

Related Questions