andrezzz
asked on
fastes reading line by line and deliting readed line
how i can create reading one line by one and readed line delete ???
there are example of my file type and data structure
type
TPrograma = record
task : string[255];
action : string[30];
windtext : string[255];
end;
var
Programa : TPrograma;
F : file of TPrograma;
while not Eof(F) do begin
Read (F, Programa);
....
end;
there are example of my file type and data structure
type
TPrograma = record
task : string[255];
action : string[30];
windtext : string[255];
end;
var
Programa : TPrograma;
F : file of TPrograma;
while not Eof(F) do begin
Read (F, Programa);
....
end;
reading one line by one and readed line delete <-- will it result in deleting all entries?
ASKER
delete one line by one. example
read line x
delete line x
read line y
delete line y
....
eof
read line x
delete line x
read line y
delete line y
....
eof
You can't just delete something from the middle of the file. You'll have to move last record to place where deleted one was and then truncate file (in case if all records/lines are with same size AND if order is not important) OR to rewrite all the file starting with deleted record - it can take a lot of time.
If you need to read and delete more lines/records at the same time, it's better to read them all and then delete them all (not one by one).
If you need to read and delete more lines/records at the same time, it's better to read them all and then delete them all (not one by one).
i have now that i read all and after that i delete. but my program read line and then send it to server. then read next line and send it too.if there will be connection error in middle of the file. how i can know whitch line i must send after connections will be ok.
i think that i send one line by one. and after line is sent, then delete it and go to next line.
is there some way to read file from end ??? then i can use truncate ....
i think that i send one line by one. and after line is sent, then delete it and go to next line.
is there some way to read file from end ??? then i can use truncate ....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.