Results 1 to 9 of 9

Thread: Data Reading and Storing in arrays

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Data Reading and Storing in arrays

    It's much simpler than that.

    Qt Code:
    1. QFile f(...);
    2. f.open(...);
    3. QList<QVector3D> points;
    4. while(!f.atEnd()) {
    5. QString line = f.readLine();
    6. QStringList list = line.split('|');
    7. QVector3D vec;
    8. vec.setX(list.at(1).toInt());
    9. vec.setY(list.at(2).toInt());
    10. vec.setZ(list.at(3).toInt());
    11. points << vec;
    12. }
    To copy to clipboard, switch view to plain text mode 

    Of course you need to provide some error checking.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    kango (4th January 2013)

Similar Threads

  1. Saving and storing data,QtSql
    By salmanmanekia in forum Newbie
    Replies: 7
    Last Post: 20th April 2010, 19:08
  2. Storing and reading back template types in QVariant
    By Daniel Dekkers in forum Qt Programming
    Replies: 1
    Last Post: 5th April 2010, 07:40
  3. storing data in hexadecimal format
    By aj2903 in forum Qt Programming
    Replies: 6
    Last Post: 13th January 2010, 05:29
  4. Storing and managing huge arrays
    By maka in forum Qt Programming
    Replies: 3
    Last Post: 22nd July 2009, 09:37
  5. Storing/Reading item creation date
    By maverick_pol in forum Qt Programming
    Replies: 2
    Last Post: 26th May 2008, 08:19

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.