Erasing the contents of a file..
-
My program is creating a file named file.prop with one of the following in it...
...
Max records=10
Temp size=94Next, I parse this file line by line and get the values...
As I finish reading a line from a file I want to erase that line from the file for e.g. I read Temp size=94. After reading this line I want to erase it from file.prop . How can this be done. Please help me out.THANKS..
-
My program is creating a file named file.prop with one of the following in it...
...
Max records=10
Temp size=94Next, I parse this file line by line and get the values...
As I finish reading a line from a file I want to erase that line from the file for e.g. I read Temp size=94. After reading this line I want to erase it from file.prop . How can this be done. Please help me out.THANKS..
Without knowing your code, hard to say. In general, if you are reading the file line by line do the following: Write each line you read to a temporary file. Once you reach the line you want to delete, skip it. Once your done reading, rename the temporary file overwriting the original file.
modified on Friday, May 16, 2008 6:57 AM
-
My program is creating a file named file.prop with one of the following in it...
...
Max records=10
Temp size=94Next, I parse this file line by line and get the values...
As I finish reading a line from a file I want to erase that line from the file for e.g. I read Temp size=94. After reading this line I want to erase it from file.prop . How can this be done. Please help me out.THANKS..
pl_kode wrote:
As I finish reading a line from a file I want to erase that line from the file
Why? What is it that you are trying to avoid?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne