OK i'm trying to make a program that saves the records in a file... this is what i got so far and isn't working.. Thanks in advance
Program AccManager;
uses crt;
Type
T_Account= record
User:string[16];
Password:string[12];
Rango:byte;
END;
Arc_acc= file of T_Account;
var
Acc:T_Account;
option:byte;
l,m:integer;
Acu:Arc_acc;
{**********Preparar o Crear Archivos*********}
Procedure Accounts(Cuenta:T_Account);
Begin
{$I-}
reset (Acu);
{$I+}
If (IOResult = 0) Then
Begin
reset(Acu); {*The file exist*}
assign(acu,'..\Data\Accounts.Gp7');
reset(Acu);
write(Acu,Cuenta);
close(acu);
End
Else
Begin
rewrite (Acu); {* the file doesn't exis *}
rewrite(Acu);
assign(Acu,'..\Data\Accounts.Gp7');
reset(Acu);
write(Acu,Cuenta);
close(acu);
End;
End;
{*********cleaning***************}
{Procedure cleaning(var Acc:T_Account);
Begin
User:='';
Password:='';
Rango:=0;
End;}
{---------------------}
{*********Register Account************}
Procedure Registering(var Acc:T_Account);{Separar en procesos, uno para cada mierda}
Begin
clrscr;
writeln('Nombre de Usuario, hasta 16 caracteres');
readln(Acc.User);
clrscr;
writeln('Password, Hasta 12 caracteres');
readln(Acc.Password);
clrscr;
writeln('Ingrese rango, 1 para Administrador, 2 para Gerente o 3 para Empleado');
readln(Acc.Rango);
Accounts(Acc);
End;
{-----------Program--------}
Begin
repeat
clrscr;
gotoxy(33,5);
writeln('Account Manager');
gotoxy(33,6);
writeln('---------------');
gotoxy(33,9);writeln('[1] register account');
gotoxy(33,10);writeln('[2] "Next time"');
gotoxy(33,11);writeln('[3] "Next time"');
gotoxy(33,12);writeln('[4] "Next time"');
gotoxy(33,13);writeln('[5] exit to windows');
readln(option);
case option of
1:Registering(Acc);
End;{case}
Until option = 5;
End.