I am trying to pass a
Path to C. Right now, the easiest way I have found is to convert the
Path to a
str and then convert it into a
CString. This seems like a bad solution because it can fail.
For more context I am trying to interoperate with the PDFium library. In the header file, it says that I need to pass a
FPDF_LoadDocument. Here is the definition of
// For Windows programmers: In most cases it's OK to treat FPDF_WIDESTRING as a // Windows unicode string, however, special care needs to be taken if you // expect to process Unicode larger than 0xffff. // // For Linux/Unix programmers: most compiler/library environments use 4 bytes // for a Unicode character, and you have to convert between FPDF_WIDESTRING and // system wide string by yourself. typedef const char* FPDF_STRING;
This seems to be very close to an
OsStr so I feel like I should be able to go through
OsString instead. Which could allow for non utf8 characters and the like.
Has anyone have to do something like this before? Does any one have any advice for me?