Hi,
I want to convert wchar_t* into char*. Can anybody tell me how to achieve this without information loss??
Thanks in advance.
Shail.
Hi,
I want to convert wchar_t* into char*. Can anybody tell me how to achieve this without information loss??
Thanks in advance.
Shail.
I think you'd have to convert it to std::wstring and then use QString::fromStdWString() to convert to a QString and then you can convert it using QString::unicode() or using qPrintable() (be ready for a data loss in this situation, as your local encoding may not support all unicode characters).
shailesh (22nd June 2006)
Thanks wysota,
But again QString.unicode will give me const QChar*. QChar is of 2 bytesin Qt. I want pure char* as i want to write it into file in UTF16 encoding.
Actually i have QString. I want to convert it in UTF16 using QString.utf16() and then I want to write it into file. But as u know QFile does not allow us to write unicode directly. So first we have to convert it into char* and then we can write it to file.
Can u give me suggestions for this??
Again thanksin advance.
Shail.
Then use QTextCodec.
Bookmarks