> <quote url=http://doc.trolltech.com/4.1/qstring.html>
> The QString class provides a Unicode character string.
> QString stores a string of 16-bit QChars, where each QChar
> stores one Unicode 4.0 character.
That sounds like UTF-16, but it's not using the terminology that would give
me warm fuzzies. There are, I believe, other 16-bit encodings, but I could
be mistaken about that. It's certainly worth a try, but Unicode is one of
those things where you'd need to try the hard stuff before you'd hit the
problems.
> So, if everybody is telling the truth, can I not just do this?
>
> const XMLCh* QtoX(const QString& s) {
> return reinterpret_cast<const XMLCh*>(s.constData());
> }
>
> const XMLCh* CtoX(const char* cs) { return QtoX(cs); }
Absent memory management issues, it's possible, yeah.
I'm not sure if that second function would work though. It seems like you're
counting on some auto-conversion via QString to convert the ASCII, and then
returning a cast of its internal buffer. That's a recipe for crash city, I
would think (temp object created, reference passed, pointer to internals
returned, object destroyed, pointer invalid).
-- Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]