Estoy tratando de abrir un fichero de un archivo que cree previamente de tipo .dat
Es un registro que contiene otros registros
type mapa = record // record que guarda todo el proyecto
mcM,mcT,mcC,mcE,mcD,mcV,mcB,mCMed : Integer; // Contadores de los componentes
// Arreglos dinámicos para guardar la información
mAmangeras : array[0..10000] of manguera;
mAtubos : array[0..10000] of tubo;
mAcasas : array[0..10000] of home;
mAEdificos : array[0..10000] of buiding;
mAdist : array[0..10000] of distribuidor;
mAValv : array[0..10000] of vavlula;
mAbomb : array[0..10000] of bombas;
mAmed : array[0..10000] of med;
// Fin arreglos
end;
Lo que hago es guardar un registro de tipo mapa en un archivo .dat con el siguiente código donde plano memoria es el registro de tipo mapa a guardar y el procedimietno crearArchivoDeRegistro guarda los datos.
if FileExists(fileName) then
begin
if MessageDlg('El archivo ya existe, desea remplazarlo?',mtConfirmation, [mbYes, mbNo],
0, mbYes) = mrYes then
begin
Rewrite (f);
crearArchivoDeRegistro();
Write(f, PlanoMeoria);
CloseFile(f);
Edit1.Text := ' ';
Close();
end;
end
else
begin
Rewrite (f);
crearArchivoDeRegistro();
Write(f, PlanoMeoria);
CloseFile(f);
Edit1.Text := ' ';
Close();
end;
end;
Se guarda sin mandar ningún error, sin embargo cuando trato de abrir el archivo con este codigo me manda I/O error 6
// Display the open file dialog
If (OpenDialog.Execute) then
begin
AssignFile(f, openDialog.Name);
reset(F);
while not Eof do // AQUI OCURRE EL ERROR
read(F, archivoParaAbrir); // AQUI OCURRE EL ERROR
CloseFile(F);
//abrirArchivosContenedoresDePlanos(archivoParaAbrir);
end;
// Free up the dialog
openDialog.Free;