delete data in file


M

Magix

Hi,

let say I have test.dat with following entry:

***********
string1 string2
string3
***********
string4 string5
string6
***********
string7 string8
string9

I would like to delete the first entry (when find the first ***********),
which is:
***********
string1 string2
string3

so that the test.dat will only have:
***********
string4 string5
string6
***********
string7 string8
string9

I don't want to use the solution of copying to a temp buffer/ temp file,
then rewrite the test.dat.
If you have other better solution, let me know. If manipulate directly with
test.dat, will be the best.

Thanks.
 
Ad

Advertisements

H

Harti Brandt

On Mon, 5 Jul 2004, Magix wrote:

M>Hi,
M>
M>let say I have test.dat with following entry:
M>
M>***********
M>string1 string2
M>string3
M>***********
M>string4 string5
M>string6
M>***********
M>string7 string8
M>string9
M>
M>I would like to delete the first entry (when find the first ***********),
M>which is:
M>***********
M>string1 string2
M>string3
M>
M>so that the test.dat will only have:
M>***********
M>string4 string5
M>string6
M>***********
M>string7 string8
M>string9
M>
M>I don't want to use the solution of copying to a temp buffer/ temp file,
M>then rewrite the test.dat.
M>If you have other better solution, let me know. If manipulate directly with
M>test.dat, will be the best.

With only standard-C available the only way is to rewrite the file.

harti
 

Top