Results 1 to 20 of 20

Thread: How to read a value from tow columns file !

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2015
    Posts
    9
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    9

    Default How to read a value from tow columns file !

    Hallo Guys,

    I have a txt-File, which contains values like that :

    distance force
    0.090721 0.0072147
    0.181527 0.0139748
    0.270888 0.0203682
    0.360796 0.0262649
    0.451177 0.0317043
    0.541753 0.0366577
    0.632632 0.0409662
    0.724928 0.0451153

    I just need to read the tow values of the last line but separately. For example: if i pressed a Qpushbutton (1) i get 0.724928, and if i pressed a Qpushbutton (2) i get 0.0451153 .

    i've tried the following code, but i always get the first value of the last line (0.724928)..my question is how to get the second value of the last line (0.0451153) ?

    QFile inputFile("measurnments.txt");
    if (inputFile.open(QIODevice::ReadOnly))
    {
    QTextStream in(&inputFile);
    while (!in.atEnd())
    {
    QString line = in.readLine();
    this->display->setText(line);
    }
    inputFile.close();
    }

    I'm just a Newbie , so i'll be grateful und i'll appreciate it if somone could help me


    Best Reagrds
    Last edited by mejacky; 4th October 2015 at 13:31.

Similar Threads

  1. Read contents from the file using QHTTP Read()?
    By Gokulnathvc in forum Newbie
    Replies: 2
    Last Post: 21st June 2011, 08:03
  2. Make a column read-only in a QSqlTableModel/QTableView
    By graciano in forum Qt Programming
    Replies: 0
    Last Post: 15th November 2009, 18:18
  3. read ascii files with different column counts
    By pospiech in forum Qt Programming
    Replies: 5
    Last Post: 6th November 2009, 12:42
  4. Replies: 6
    Last Post: 6th August 2009, 17:18
  5. Replies: 8
    Last Post: 28th May 2007, 20:32

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.