Subj : Door Game Help????
To : All
From : Becky Mcmillen
Date : Thu Jan 17 2008 09:42 pm
Hello,
I am having a bit of trouble with a door game I am making. I cannot for the
life of me get the user data to read/write from a user.dat file. Here is a
snippet of code and maybe someone can tell me where I am going wrong to search
the record for a user (Using DDPLUS) for a user name, and if found pull it
out. If not, create a new? Thank You In Advance!
Begin
assign(UserFile, 'SYSUSERS.DAT');
{ rewrite(UserFile);}
reset(UserFile);
read(UserFile, SysOp);
I:=1;
Found:= FALSE;
While (I <=750) and (Not Found) do
Begin
write(I);
with SysOp[I] do
Found := (Users.Name1 = User_First_Name) and (Users.Name2 = User_Last_Name);
inc(I);
end;
If Found = TRUE then begin
{ sclrscr; }
swriteln('Welcome Back!');
I:=I-1;
writeln ('User #');
writeln (I);
readln;
assigndata(SysOp[I]);
reset(UserFile);
write(UserFile, SysOp);
Close(UserFile);
end
else begin
{ sclrscr;}
swriteln('YOU ARE NEW!!!!!!!!!!!!!!!');
I:=1;
while (SysOp[I].Name1 <> '') and (I <=750) do
inc(I);
assigndata(SysOp[I]);
reset(UserFile);
write(UserFile, SysOp);
Close(UserFile);
end;
end;