(urgent)How to edit a file
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   prasath_subramanian
Posted On:   Thursday, October 19, 2006 04:42 AM

hai,
i am having a file eg., 1.txt in that suppose i have a content called "hai how are u".. in this i want to remove only the "hai" and i should save the rest of the content in the same file. that is after delete the content i should come out of the file by keeping the rest content there.. is there is any example to do this kind of operations..

regards
subramanian

Re: (urgent)How to edit a file

Posted By:   Stephen_Ostermiller  
Posted On:   Sunday, October 29, 2006 05:22 AM

For such a short file, it is easiest to:


  1. Read the file into memory

  2. Modify the contents in memory

  3. Write all the contents back out to disk



I'd suggest you look into FileReader and FileWriter which can help you with the first and third tasks respectively.

Re: (urgent)How to edit a file

Posted By:   Robert_Lybarger  
Posted On:   Thursday, October 19, 2006 08:54 AM

Are you only wanting a certain word removed, or always the first word of the file removed, or the first word on all lines removed, or ... ?
About | Sitemap | Contact