Results 1 to 10 of 10

Thread: How to to overwrite lines in text file in Qt

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2020
    Posts
    7
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default How to to overwrite lines in text file in Qt

    Hi All,
    i am new to Qt.

    i am creating the file in and logging some data to file every time some data is available.
    but issue is once i reach max file size defined for file and new data is available then i have to move the first line and overwrite the data in line 1 with new data i am not able to move to first line and it is appending at the last always.

    example:
    once i reach the max file size and currently the cursor position is at the end of the file then cursor position should be moved to 1st line and new data has to be replace with data in 1st line after replacing the data the cursor should be move to 2nd line in the file.
    to achieve this i am using seek() function to move to line but still i am not able to write data it is always


    How can i move to first line and overwrite the data?

    Thank you,

    Regards,
    Anamika
    Last edited by Anamika s; 23rd September 2020 at 10:13.

Similar Threads

  1. How to know how many lines a text files has?
    By Momergil in forum Qt Programming
    Replies: 2
    Last Post: 15th July 2013, 04:45
  2. overwrite pdf file
    By terhje in forum Newbie
    Replies: 2
    Last Post: 22nd February 2012, 12:41
  3. Replies: 6
    Last Post: 17th April 2009, 10:09
  4. Replies: 2
    Last Post: 28th March 2009, 10:11
  5. I want to get lines of text
    By newplayer in forum Qt Programming
    Replies: 11
    Last Post: 29th July 2008, 09:03

Tags for this Thread

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.