[Qt-interest] working with qfile

Thiago Macieira thiago at kde.org
Tue Sep 27 09:49:35 CEST 2011


On Tuesday, 27 de September de 2011 11:19:07 Sahana Bhaskar wrote:
> Hi,
> 
> I want to first check if the text exists in the text file, if so I need to
> replace the line with a new line, and if not I need to append my line to
> the text file. Another concern I have is,  I do not want to use 2 files to
> do it.

If you don't have a better solution than ours using 2 files, use 2 files.

 > e.g. if below is the text my original file is:
> 
> abcd:12
> efgh:56
> ijkl:90
> mnop:90
> 
> I need to check if mnop is present and if so my code must replace “mnop:90”
> with say “mnop:98”. And in case that line is not present then it should
> append “mnop:98” to the text file.

Our solution will do that.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110927/ef729fed/attachment.bin 


More information about the Qt-interest-old mailing list