[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
{ This program demonstrates the process you need to go through to read or
write information to the users.dat file.}
USES
Crt; { Include CRT unit for screen functions }
{$I Records.Pas} { Include the Renegade BBS record definitions file }
TYPE
UserFile_Type = file of Userrec; { Define the file variable TYPE }
VAR
One_User_Record : Userrec; { Define one user record variable }
UserFile : UserFile_Type; { Define the actual file variable }
Key : char; { Used to get a user response }
Count : integer; { Keeps track of record numbers }
Begin
(*************************** NOTICE THIS ********************************
***************************************************************************
The ASSIGNMENT statement below must contain THE COMPLETE path to your
Renegade.Dat File. The following is the generic path, if yours is
different, you will need to change it below.
**************************************************************************
**************************************************************************)
Assign(UserFile,'C:\RENEGADE\DATA\USERS.DAT');
{ Make the file variable
point to USERS.DAT }
{$I-} { Error checking off }
Reset(UserFile); { Open USERS.DAT file }
{$I+} { Error checking back on}
If IOResult = 0 then { 0 = no error occured}
Begin
count :=0; { Set Counter to 0; }
Read(UserFile,One_User_Record); { Read in the first record,
which is the dummy record
that isn't used by the
BBS. (Record #0) }
Repeat { loop starts here }
Clrscr; { Clear the screen }
If (EOF(UserFile)) then { End of file? If so, then}
begin { Close the file & exit }
Close(UserFile);
Writeln ('No more records to read!');
Writeln ('Press a key to exit.');
Key := readkey;
Halt;
end
else { But if NOT end of file..}
begin
Read(UserFile,One_User_Record); { Read in data on User #1}
Inc(Count); { Increment Counter }
{ Now we will display the data in the fields of One_User_Record.}
Writeln('User No. : ',Count);
Writeln('Handle : ',One_User_Record.Name);
Writeln('Real Name: ',One_User_Record.Realname);
Writeln('Password : ',One_User_Record.Pw);
Writeln('Phone No.: ',One_User_Record.Ph);
Writeln('Birthday : ',One_User_Record.Bday);
Writeln('Address 1: ',One_User_Record.street);
Writeln('Address 2: ',One_User_Record.citystate);
Writeln('Sex : ',One_User_Record.Sex);
GotoXY(12,15); { Position Cursor }
Write('Press ESC to abort or another key to continue');
Key := readkey;
end;
Until Key = #27; { 27 is the Escape Character}
end
Else { we DID get an error opening USERS.DAT }
Begin
Clrscr;
Writeln('ERROR OCCURED! Program could not open USERS.DAT file.');
End;
End. {program}
*-----------------------------------------------------------------------------*
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson