[Qt-interest] QString to char array
Avishek_Sharma
Avishek_Sharma at satyam.com
Mon Dec 29 09:57:52 CET 2008
Hi Robin,
thanks for the suggestion.I will try it out.
regards,
Avi
________________________________________
> Hi,
> I came across this piece of code to convert/copy from QString to char array.
>
> char arr[255];
> QString str;
> strcpy(arr,str.toAscii().constData());
>
> will this code work?
Yes, it works, but your example is a dangerous when you are copying to
a fixed sized array, better use strncpy in such cases.
The best however would be if you could keep it as a QString the whole
way through your application.
--
regards,
Robin
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.
More information about the Qt-interest-old
mailing list