Results 1 to 13 of 13

Thread: how to copy QString content into array

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to copy QString content into array

    Quote Originally Posted by eric View Post
    The below code compiles but is not doing anything.
    You have two name variables and you change only one of them.

  2. The following user says thank you to jacek for this useful post:

    eric (15th November 2007)

  3. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to copy QString content into array

    ...and the other is not even a string. To copy the content of QString into the buffer, you'll need something like this:
    Qt Code:
    1. char name[50];
    2. QString str = "xxx";
    3. strncpy(name, str.toLocal8Bit().constData(), 50);
    To copy to clipboard, switch view to plain text mode 

  4. The following user says thank you to wysota for this useful post:

    eric (15th November 2007)

Similar Threads

  1. how to copy part of QString to anothe QString
    By nass in forum Qt Programming
    Replies: 1
    Last Post: 26th March 2007, 19:05
  2. Problem in converting QString to QChar array?
    By KaKa in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2007, 00:38
  3. Convert from iso-8859-1 to... Something else :-)
    By Nyphel in forum Qt Programming
    Replies: 4
    Last Post: 7th March 2007, 17:59

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.