How to open a file with UNICODE filename on Windows?
-
There is a 3rd lib only accept char* filename e.g.
3rdlib_func_name(char* file_name)
. Every things get wrong when I provide a filename in Chinese or Japanese. Is there any way to make this lib open UNICODE filename? The program is running on Windows. Thanks for your reply.
A Chinese VC++ programmer
-
There is a 3rd lib only accept char* filename e.g.
3rdlib_func_name(char* file_name)
. Every things get wrong when I provide a filename in Chinese or Japanese. Is there any way to make this lib open UNICODE filename? The program is running on Windows. Thanks for your reply.
A Chinese VC++ programmer
-
There is a 3rd lib only accept char* filename e.g.
3rdlib_func_name(char* file_name)
. Every things get wrong when I provide a filename in Chinese or Japanese. Is there any way to make this lib open UNICODE filename? The program is running on Windows. Thanks for your reply.
A Chinese VC++ programmer
-
Fareed Rizkalla wrote:
If your app is UNICODE! Their is a function to change UNICODE string to CHAR! wcstombs[^] But I guess that won't fix it either if your filenames are in UNICODE.
Yes, even if I transferred the UNICODE filename to a char*(using CP_ACP or CP_UTF8), the 3rd lib don't accept this filename and returns a "file not found" error code.
A Chinese VC++ programmer
-
zengkun100 wrote:
Is there any way to make this lib open UNICODE filename?
Only by changing its source code. You will have to go to the suppliers of the library to get it changed if you do not have the source.
It's time for a new signature.
Richard MacCutchan wrote:
Only by changing its source code. You will have to go to the suppliers of the library to get it changed if you do not have the source.
I think so. In theory, char* cant only be used to point to a UTF8 UNICODE string, however, you cannot give a UTF8 filename to
fopen
or some other file functions. But if I transfer this UNICODE filename to char* using CP_ACP, some of the characters cannot be changed.A Chinese VC++ programmer
-
Richard MacCutchan wrote:
Only by changing its source code. You will have to go to the suppliers of the library to get it changed if you do not have the source.
I think so. In theory, char* cant only be used to point to a UTF8 UNICODE string, however, you cannot give a UTF8 filename to
fopen
or some other file functions. But if I transfer this UNICODE filename to char* using CP_ACP, some of the characters cannot be changed.A Chinese VC++ programmer
Exactly right, which is why all software suppliers should be providing full Unicode support. I think you need to talk to the supplier of the library and get them to change it. You may also note that
_wfopen
is the Unicode version of the file open function, so there is no problem with Unicode file names.It's time for a new signature.
-
Exactly right, which is why all software suppliers should be providing full Unicode support. I think you need to talk to the supplier of the library and get them to change it. You may also note that
_wfopen
is the Unicode version of the file open function, so there is no problem with Unicode file names.It's time for a new signature.
Thanks for your reply again :) We have called our partner this afternoon.
A Chinese VC++ programmer