Results 1 to 17 of 17

Thread: char* from QString

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    76
    Thanked 37 Times in 32 Posts

    Default Re: char* from QString

    Waw !!

    Beautiful answer... Thanks a lot for the time and patience.
    Long live QtCentre
    We can't solve problems by using the same kind of thinking we used when we created them

  2. #2
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    76
    Thanked 37 Times in 32 Posts

    Default Re: char* from QString

    After this discussions and the subsequent discussion with Qt-Interest mailing list. I had requested the change told above. Trolltech has accepted the change request and has modified the faq

    Here is the link to that

    http://www.trolltech.com/developer/k...-30.9032238253


    Thanks once again.
    We can't solve problems by using the same kind of thinking we used when we created them

  3. The following user says thank you to sunil.thaha for this useful post:

    bruccutler (13th February 2007)

  4. #3
    Join Date
    Jan 2007
    Posts
    209
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Re: char* from QString

    Btw, jacek wrote delete [] cstr, but you dont need to delete a pointer unless you initialized it with new keyword.

  5. #4
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    76
    Thanked 37 Times in 32 Posts

    Default Re: char* from QString

    From the docs:
    char * qstrdup ( const char * src ) Returns a duplicate string.
    Allocates space for a copy of src, copies it, and returns a pointer to the copy. If src is 0, it immediately returns 0.
    Ownership is passed to the caller, so the returned string must be deleted using delete[]
    We can't solve problems by using the same kind of thinking we used when we created them

Similar Threads

  1. QString problem
    By vermarajeev in forum Qt Programming
    Replies: 9
    Last Post: 26th October 2006, 19:10
  2. Replies: 2
    Last Post: 12th October 2006, 09:17
  3. QSqlQueryModel + set Write
    By raphaelf in forum Qt Programming
    Replies: 7
    Last Post: 5th June 2006, 08:55
  4. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52
  5. How to create custom slot in Qt Designer 4.1?
    By jamadagni in forum Qt Tools
    Replies: 31
    Last Post: 18th January 2006, 20:46

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.