Click to See Complete Forum and Search --> : How to modify a file's content?


chinajiang
May 27th, 1999, 11:38 AM
I want to change a file's content,such as ,I want to delete or modify a random line of a file.
How to do this?

May 27th, 1999, 01:49 PM
You can open a second file read from the first and write to the second. In the process you can make your modifications. For example skipping a line etc. When done close second file(with a temporary name), delete the origianl and rename the temp file to the original name. A bit safer than reading the file into memory truncating the file to zero length and writing from memory to file.

Hope this helps