#include <wx/strconv.h>
This class used to define the class instance wxConvFileName, but nowadays wxConvFileName is either of type wxConvLibc (on most platforms) or wxConvUTF8 (on MacOS X).
wxConvFileName converts filenames between filesystem multibyte encoding and Unicode. wxConvFileName can also be set to a something else at run-time which is used e.g. by wxGTK to use a class which checks the environment variable G_FILESYSTEM_ENCODING indicating that filenames should not be interpreted as UTF8 and also for converting invalid UTF8 characters (e.g. if there is a filename in iso8859_1) to strings with octal values.
Since some platforms (such as Win32) use Unicode in the filenames, and others (such as Unix) use multibyte encodings, this class should only be used directly if wxMBFILES is defined to 1. A convenience macro, wxFNCONV
, is defined to wxConvFileName->cWX2MB
in this case. You could use it like this:
wxChar *name = "rawfile.doc"; FILE *fil = fopen(wxFNCONV(name), "r");
(although it would be better to just use wxFopen(name, "r") in this particular case, you only need to use this class for functions taking file names not wrapped by wxWidgets.)
![]() |
[ top ] |