[Rd] wchar and wstring.

James Bullard bullard at berkeley.edu
Sat Aug 27 00:56:14 CEST 2005

Hello all, I am writing an R interface to some C++ files which make use
of std::wstring classes for internationalization. Previously (when I
wanted to make R strings from C++ std::strings), I would do something
like this to construct a string in R from the results of the parse.

SET_VECTOR_ELT(vals, i++, mkString(header.GetHeader().c_str()));

However, now the call header.GetHeader().c_str() returns a pointer to an
array of wchar_t's. I was going to use
wcstombs() to convert the wchar_t* to char*, but I wanted to see if
there was a similar function in R for the mkString function which I had
initially used which deals with wchar_ts as opposed to chars. Also,
since I have no experience with the wctombs() function I wanted to ask
if anyone knew if this will handle the internationilzation issues from
within R.

As always thank you for the help. jim

More information about the R-devel mailing list