views:

225

answers:

1

I'm having some trouble using wchar_t* strings for copying a file, how do I open them in C/C++ I need to use wide chars because the filenames are in unicode with different foreign languages.

Thanks in advance.

+1  A: 

You need to distinguish between unicode file names, and unicode file content. Unfortunately, standard C/C++ only deals with wchar_t for file content. Using wchar_t for file names is platform-specific (hence Brian Bondy's question for clarification).

On Windows, you have to use Microsoft-specific API (such as _wfopen) to open a file with a wchar_t name. On all other systems, you need to use char as the data type for file names.

Martin v. Löwis