Results 1 to 3 of 3

Thread: QVector<float> to QByteArray without programming

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QVector<float> to char*

    You can just take the address of the first member, assuming QVectors work like C++ vectors:

    char* c = &(myVector[0]);

    This assumes, though, that QVector behaves in such a way that doing so makes sense. It may not. If it doesn't behave itself, you'll have to loop through the array and do something similar to the above with each element.

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

    Naami (23rd May 2010)

Similar Threads

  1. float vs double
    By Royceybaby in forum General Programming
    Replies: 4
    Last Post: 27th January 2010, 21:55
  2. Replies: 14
    Last Post: 16th March 2009, 09:19
  3. Replies: 1
    Last Post: 10th February 2009, 09:42
  4. char to const char* with atof
    By mickey in forum General Programming
    Replies: 5
    Last Post: 29th February 2008, 04:10
  5. float
    By mickey in forum General Programming
    Replies: 5
    Last Post: 25th July 2006, 11:52

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.