[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Extracting the bytes from a Unicode QString
From:       Michael Pyne <pynm0001 () unf ! edu>
Date:       2005-10-02 20:59:43
Message-ID: 200510021659.48122.pynm0001 () unf ! edu
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Sunday 02 October 2005 15:58, Roberto Cappuccio wrote:
> This is the code that doesn't work:
>
>     int len = qsValue.utf8().length();
>     int nRes = sqlite3_bind_text( mpVM, nParam,
>     (const char*)qsValue.utf8().data(), -1, SQLITE_STATIC );
>
> I really don't understand why the second way does not work for me.

Perhaps it's because you're casting the return value of a temporary object?  
I'm not sure on the exact behavior in C++ but what I think is happening is 
that you're destroying the QCString before the sqlite3_bind_text() call.  
Something like this:

  QCString utf8str = qsValue.utf8();
  int nRes = sqlite3_bind_text( mpVM, nParam, (const char*)utf8str.data(), -1, 
SQLITE_STATIC );

Regards,
 - Michael Pyne

[Attachment #5 (application/pgp-signature)]

 =

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscrib=
e <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic