Results 1 to 5 of 5

Thread: How to read changing file contents

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to read changing file contents

    The method both of you described to find the change in file may be correct. But actually that isn't my problem.
    call readAll()
    a change is made in the file externally.
    call readAll()
    in both calls, i am getting same result. That means, the change is not seen on the output.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,346
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: How to read changing file contents

    Close the file, then reopen it, or create a new QTextStream each time you want to read it. QTextStream caches the file contents on the first readAll(), so when you ask for it again, you get the same thing. You could try calling seek( 0 ), but that still might not empty the cache.

Similar Threads

  1. Read contents from the file using QHTTP Read()?
    By Gokulnathvc in forum Newbie
    Replies: 2
    Last Post: 21st June 2011, 09:03
  2. Replies: 8
    Last Post: 17th June 2011, 01:35
  3. Display contents of .txt file
    By karmo in forum Newbie
    Replies: 17
    Last Post: 23rd January 2010, 21:39
  4. QTableView and changing how a cell displays its contents
    By BitRogue in forum Qt Programming
    Replies: 2
    Last Post: 9th October 2009, 11: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
  •  
Qt is a trademark of The Qt Company.