Finally, I got it!!
procedure InsertaUnElementoEnFicheros (var LaLista : tListaFicheros; dato : tFichero );
var
PunteroAuxiliar, PunteroPrecedente, PunteroTMP : tListaFicheros;
Insertado : BOOLEAN;
begin
if Lalista = NIL then LaLista := CreaLaListaDeFicheros(dato)
else
begin
PunteroAuxiliar := Lalista;
PunteroPrecedente := LaLista;
Insertado := FALSE;
while (PunteroAuxiliar <> NIL) and (not Insertado) do
begin
if dato.tamano <= PunteroAuxiliar^.contenido.tamano then
begin
Insertado := TRUE;
new (PunteroTMP);
PunteroTMP^.contenido := dato;
PunteroTMP^.siguiente := PunteroAuxiliar;
if PunteroPrecedente = LaLista then LaLista := PunteroTMP
else PunteroPrecedente^.siguiente := PunteroTMP;
end
else
begin
PunteroPrecedente := PunteroAuxiliar;
PunteroAuxiliar := PunteroAuxiliar^.siguiente;
end;
end;
if not Insertado then
begin
new (PunteroTMP);
PunteroTMP^.contenido := dato;
PunteroTMP^.siguiente := NIL;
PunteroPrecedente^.siguiente := PunteroTMP;
end;
end;
end;
Best Regards!!