[Qt-interest] QString to char array

Avishek_Sharma Avishek_Sharma at satyam.com
Mon Dec 29 05:31:27 CET 2008


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?
I am working on a photo gallery and I need to convert from QString(the file path is stored in a variable of type QString)to char array (I haven't yet started on  that section ).So, I would appreciate it if someone would let me know if this code will work.If you think it won't work then please give me some idea of how to do it.
Thanks in advance.

Avi






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