Results 1 to 7 of 7

Thread: Conversion Char Array to string

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Posts
    91
    Thanks
    8

    Default Re: Conversion Char Array to string

    it is not working,

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 86 Times in 81 Posts

    Default Re: Conversion Char Array to string

    Quote Originally Posted by anafor2004 View Post
    it is not working,
    Very very good error description...

    What does not work? What did you try to fix it? Did you even try to solve it the way the former posts suggested?

  3. #3
    Join Date
    Apr 2008
    Location
    Pavlodar, Kazakhstan
    Posts
    22
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1
    Thanked 5 Times in 5 Posts

    Default Re: Conversion Char Array to string

    The last method is incorrect. You cannot just assign a pointer to char array to a pointer to QString. Why don't use the solution I've suggested earlier? There is no need to make things harder. If you need QString not only to set for a label but for other aims too, just instantiate QString with your array as a parameter:
    Qt Code:
    1. char array[] = "Some text";
    2. QString string(array);
    To copy to clipboard, switch view to plain text mode 
    Last edited by mitro; 6th May 2008 at 16:03.

Similar Threads

  1. Char Array to QString
    By 3nc31 in forum Qt Programming
    Replies: 2
    Last Post: 25th November 2007, 22:18
  2. Conversion from unsigned char* to unsigned char
    By santosh.kumar in forum General Programming
    Replies: 1
    Last Post: 6th August 2007, 13:12
  3. unable to save QCStrings properly in a buffer
    By nass in forum Qt Programming
    Replies: 13
    Last Post: 15th November 2006, 20:49
  4. String Array
    By Sarma in forum Qt Programming
    Replies: 1
    Last Post: 13th May 2006, 07:53
  5. How to get size (length, width ....) of string or char
    By Krishnacins in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2006, 09:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.