Results 1 to 4 of 4

Thread: how i find and replace the text in text file through QT 4 interface

  1. #1
    Join Date
    Apr 2009
    Posts
    24
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default how i find and replace the text in text file through QT 4 interface

    i am using QT 4 ..and now i want to change in text file which stored in that folder.
    for example "a.txt"......i wana find text and replace text when i push "ENTER" button.
    plz reply i m in trouble

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how i find and replace the text in text file through QT 4 interface

    I'm not 100% sure of what you mean. Do you want to open a file, replace some text in it and then write it back to the same file?

    In that case, I suggest that you start with a QFile, read its contents into RAM (I assume that the file is reasonably sized) using readAll, do the replacement (QString::replace might work), and then re-open the file for writing and write it all back there.

  3. #3
    Join Date
    Apr 2009
    Posts
    24
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how i find and replace the text in text file through QT 4 interface

    thx 4 rply..............actually i mean to say that i have created interface like that

    enter IP Address:.............................
    enter host name:...........................
    :SAVE BUTTON:

    when we click it then these two fields save in file, which is stored in file...
    this file is same like that fields such as...
    IP Address=_._._._
    Host name=_____
    etc....

    So i want to code for "Find" record and replace record through interface.

    plz reply

  4. #4
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how i find and replace the text in text file through QT 4 interface

    You could use a QSettings object.

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.