I have a project to do for the college, which has to insert, read, delete and modify records in a binary file (a address book or something else). I don't know yet how I'll do to alter the records. Let's suppose the I have the program below:
reg = record
arquivo: file of reg;
The user will enter the id he wants to alter, i have done it this way, but it truncate the file at the current position:
while not eof(arquivo) do begin read(arquivo,dados); if (dados.id = new) then begin dados.id:=new; write(arquivo,dados); break; end; end;
Could somebody help me with this?
Thanks in advance.