Skip to content

Instantly share code, notes, and snippets.

@matipan
Created June 8, 2016 18:00
Show Gist options
  • Save matipan/9a94fb2319837edefe79d3e8bb50f5b1 to your computer and use it in GitHub Desktop.
Save matipan/9a94fb2319837edefe79d3e8bb50f5b1 to your computer and use it in GitHub Desktop.
procedure eliminar(var arch: tArchRopaDeportiva; marca: tRegMarca);
var
mActual, mTemporal: tRegMarca;
tmp: string;
iBorrar: longint;
begin
reset(arch);
read(arch, mTemporal);
mActual := mTemporal;
if(mTemporal.nombre = '0') then
begin
{ Se guarda la marca y luego se la busca }
while(not eof(arch) and mActual.codigo <> marca.codigo) do
begin
read(arch, mActual);
end;
if not eof(arch) then
mTemporal.nombre := IntToStr(filepos(arch)-1);
mActual.nombre := '0';
seek(arch, filepos(arch)-1);
write(arch, mActual);
end
else begin
while(not eof(arch) and mActual.codigo <> marca.codigo) do
begin
read(arch, mActual);
end;
mActual.nombre := mTemporal.nombre;
mTemporal.nombre := IntToStr(filepos(arch)-1);
seek(arch, filepos(arch)-1); write(arch, mActual);
seek(arch, 0); write(arch, mTemporal);
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment