私はレコードとレコードファイルを持っています。私はファイルの内容を読むことができません。私はファイルから読み込み、MiGuardeというレコードにデータを保存しようとします。私がMiGuardeを印刷しようとすると(私のファイルにデータがあります)、何も表示されません。パスカルのread()ファイル
uses crt;
type GUARDERIA = record nombre, direccion : string[20];
total_caniles, cantidad_caniles, nro_mascota : integer;
valor_canil : real;
end;
GU = file of GUARDERIA;
var eleccion : integer; G : GU;
MiGuarde : GUARDERIA;
procedure CREAR_GUARDERIA;
begin
assign(G,'C:\Users\MACIEL\Desktop\TP3 Algoritmos\GUARDERIAS.DAT');
reset(G);
if eof(G) then begin
writeln('Ingrese el nombre de la Guarderia: ');
readln(MiGuarde.nombre);
writeln('Ingrese el total de caniles : ');
readln(MiGuarde.cantidad_caniles);
MiGuarde.nro_mascota := 0;
writeln('Ingrese el valor por dia: ');
readln(MiGuarde.valor_canil);
writeln('Ingrese la direccion: ');
readln(MiGuarde.direccion);
write(G,MiGuarde);
end
else begin
writeln('Ingrese el nuevo valor de estadia o "0" para salir');
readln(eleccion);
if eleccion > 0 then begin
MiGuarde.valor_canil := eleccion;
write(G,MiGuarde);
end;
end;
reset(G);
read(G,MiGuarde);
writeln(MiGuarde.nombre,'-',MiGuarde.cantidad_caniles);
readkey;
close(G);
end;
begin
repeat
ClrScr;
writeln('MENU');
writeln();
writeln('1. Generar guarderia (o modificar valor).');
writeln('8. Salir.');
writeln();
writeln('- ');
readln(eleccion);
case eleccion of
1 : CREAR_GUARDERIA;
8 : exit;
end;
until eleccion = 8;
readkey;
end.
'read(G、MiGuarde);などが実際に実行されていますか?どのようなパスカルプログラミング環境を使用していますか? – MartynA
@MartynA:TP3 Algoritmos \ GUARDERIAS.DATのため、Turbo Pascal 3が疑わしい。 –