So I'm trying to make a login for a program which simply checks through a text file for a ID(username) and a password but I get the I/O error 103 with this code and I can't figure out why. I am at a very basic level of delphi so sorry for the bad code etc
procedure TfrmLogin.btnLoginClick(Sender: TObject);
var
ID, Password: String;
PATLogins: TextFile;
checkpass, checkID: String;
correctpass, correctID: Boolean;
begin
ID:= edtID.Text;
Password:= edtPassword.Text;
correctID:= False;
correctpass:= False;
AssignFile(PATLogins, 'PATLogins.txt');
CloseFile(PATLogins);
Reset(PATLogins);
while ((NOT EOF(PATLogins)) OR (checkID = ID)) do
begin
ReadLn(PATLogins, checkID);
end;
if (checkID = ID) then
begin
correctID:= True;
end;
if EOF then
begin
ShowMessage('Incorrect ID');
edtID.Clear;
end;
CloseFile(PATLogins);
reset(PATLogins);
while ((NOT EOF(PATLogins)) OR (checkpass = Password)) do
begin
ReadLn(PATLogins, checkpass);
end;
if (checkpass = Password) then
begin
correctpass:= True;
end;
if EOF then
begin
ShowMessage('Incorrect Password');
edtPassword.Clear;
end;
CloseFile(PATLogins);
if (correctID = True) AND (correctpass = True) then
begin
frmLogin.Close;
end;
end;