Ver Mensaje Individual
  #5  
Antiguo 07-02-2007
Avatar de jorgegetafe
jorgegetafe jorgegetafe is offline
Miembro
 
Registrado: dic 2006
Posts: 238
Reputación: 18
jorgegetafe Va por buen camino
Exclamation

¿y para leer el archivo resultante como se haria? (para meterlo en memoria)

Tengo puesto esto pero me da un error en tiempo de ejecucion.

Código Delphi [-]
 
PROGRAM Pract_3a_5_5;      {$APPTYPE CONSOLE}
USES
  SysUtils, crt;
TYPE
  informacion = RECORD
  nombre: STRING[20];
  apellidos: STRING[20];
  NIF: STRING[20];
END;
  agenda = ARRAY [1..5] OF informacion;
  archivo = FILE OF informacion;
VAR
  a: agenda;
  i: integer;
(******************************************************************************)
PROCEDURE leerDatos;                                                            (* Mete en memoria el contenido del fichero: "Datos.dat" *)
  VAR
    grabado: archivo;
  BEGIN
    assign (grabado, 'Datos.dat');
    reset (grabado);
    FOR i:=1 TO 5 DO
      read (grabado, a[i]);     (* Aqui da el ERROR= "project raised exception class EinOutError with message 'read beyond end of file' *)
    close (grabado);
    writeln ('Datos leeido correctamente del fichero Datos.dat.');
    writeln;
    writeln ('Pulse intro para continuar');
    readln;
  END;
(******************************************************************************)
Responder Con Cita