Please help me somebody to convert unicodestring into string
This is how i am getting unicodestring
UnicodeString _str = OpenDialog1->FileName;
Or if it possible to write into file unicode string with ifstream or something like that?
Thanks
Please help me somebody to convert unicodestring into string
This is how i am getting unicodestring
UnicodeString _str = OpenDialog1->FileName;
Or if it possible to write into file unicode string with ifstream or something like that?
Thanks
Converting your string to bytes would require some encoding. There are various libraries that do this, so it depends on the framework you are using.
As an alternative, you could use
wofstream
to writewchar_t
characters to the stream.Depending on your needs, assign the
UnicodeString
to anAnsiString
or aUTF8String
, and then write that to your file instead of the originalUnicodeString
itself:Or:
To pass an
AnsiString
/UTF8String
to an STL function, you have to either:1) use the
c_str()
method:2) construct a temp
std::string
:3) in the case of
AnsiString
only, specify theVCL_IOSTREAM
define in your project to enable AnsiString's own<<<
and>>
operators:us is (ICU) UnicodeString