Results 1 to 4 of 4

Thread: Read the last three lines from a file

  1. #1
    Join Date
    Aug 2012
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Read the last three lines from a file

    How to read the only last three lines from a file in qt?

  2. #2
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Read the last three lines from a file

    use readLine function in QFile

    hope it helps
    Bala

  3. #3
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Read the last three lines from a file

    Check this:-

    Last3Lines.zip
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  4. #4
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Read the last three lines from a file

    Read the file backwards by chunks and stop when you have found the beginning of the third-from-the-end line or the beginning of the file. Of course reading a text file backwards only works for self-synchronizing encodings (well, the only thing you need is the ability to synchronize on line ending sequences).

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. read from file two lines
    By mmm286 in forum Newbie
    Replies: 6
    Last Post: 26th October 2009, 12:42
  3. Remove Duplicate Lines in a file
    By nmuntz in forum Qt Programming
    Replies: 4
    Last Post: 12th January 2009, 00:04
  4. How to get multiple lines values in XML file..
    By dark1988 in forum Qt Programming
    Replies: 3
    Last Post: 22nd July 2008, 08:24
  5. Read delimited Lines in a file
    By mourad in forum Newbie
    Replies: 1
    Last Post: 19th April 2008, 09:18

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.