Results 1 to 4 of 4

Thread: How to modify the content of text file

  1. #1
    Join Date
    Jul 2009
    Location
    Bangalore
    Posts
    68
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default How to modify the content of text file

    Hi All,

    i have a text file in the format
    #n X Y Z
    0 123 456 789
    1 321 654 987
    2 345 243 809
    ......
    .....
    ...... and so on

    the user inputs a linenumber of the text file from the number lineEdit the corresponding X,Y,Z values of that line i am able to read and put into the corresponding lineedits.now i need to modify the contents of linenumber and again write into the same file, please help us how to do this.
    Last edited by grsandeep85; 31st July 2009 at 10:17.
    Thanks & Regards
    Sandeep G.R.

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to modify the content of ext file

    its really irritating and ridiculously funny that you are still stuck with just reading a text file and posting similar topics again .. that too with a powerfull Qt toolkit at your disposal.. nobody can code for you.. what did you already tried?

  3. #3
    Join Date
    Jul 2009
    Location
    Bangalore
    Posts
    68
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to modify the content of text file

    I am able to read the particluar line number now i am not able to modify the content of the same linenumber again write back into the text file.
    Thanks & Regards
    Sandeep G.R.

  4. #4
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to modify the content of text file

    you cannot... first of all dont think that the file has the same layout on disk as you see it in notepad... there is no way to tell the file pointer to go directly to a certain line if all the lines are of variable lengths. what you can do is to read the whole file in a QStringList and then modify the QStringList and write back the whole stringlist

Similar Threads

  1. Read binary from file
    By weldpua2008 in forum Newbie
    Replies: 2
    Last Post: 3rd April 2009, 23:50
  2. Saving QLabel content in a file
    By Caius Aérobus in forum Newbie
    Replies: 1
    Last Post: 29th October 2008, 17:03
  3. Can you specify a file engine?
    By skimber in forum Qt Programming
    Replies: 2
    Last Post: 18th September 2008, 15:54
  4. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  5. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21

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.