home *** CD-ROM | disk | FTP | other *** search
- {--------------------------------------------------------------------}
- {- Before compiling this demo program make sure the Unit Directories-}
- {- in the Options, Directories menu specify where to find the -}
- {- FlashPac Units. -}
- {- -}
- {- Compiler Directory -}
- {- -------- ----------------- -}
- {- TP4 A:\TP4 -}
- {- TP5 A:\TP5 -}
- {- TP55 A:\TP55 -}
- {- -}
- {--------------------------------------------------------------------}
-
- program testit;
- uses crt,dos,FPDisk,FPPrt;
- Var
- Buf : Array[1..20000] Of Char;
- Fil : Text;
- FilSize : LongInt;
- Handle,NBytes,WBytes : Integer;
- Done : Boolean;
- Ch : Char;
-
- Function TestDosErrNo : Boolean;
- Begin
- TestDosErrNo := False;
- If (IOResult <> 0) Or (DosErrNo <> 0) Or (CErrCode <> 0) Then Begin
- Writeln('IOResult = ',IOResult:1);
- Writeln('DosErrNo = ',DosErrNo:1);
- Writeln('CErrCode = ',CErrCode:1);
- Writeln('CErrType = ',CErrType:1);
- Writeln('CErrDrive = ',CErrDrive:1);
- Writeln('CErrDevice = ',CErrDevice);
- Writeln;
- ResetErrCodes;
- TestDosErrNo := True;
- End;
- Writeln('Press Enter to continue...');
- Readln;
- End;
-
- begin
- FillChar(Buf,SizeOf(Buf),'A');
- ClrScr;
- SetInt24;
- Writeln('doing createfile');
- CreateFile('a:Test',0,Handle);
- Done := TestDosErrNo;
- Writeln('doing writefile');
- WriteFile(Handle,SizeOf(Buf),Buf,WBytes);
- Done := TestDosErrNo;
- Writeln('doing closefile');
- CloseFile(Handle);
- Done := TestDosErrNo;
- Writeln('doing openfile');
- OpenFile('A:Test',2,Handle);
- Done := TestDosErrNo;
- Writeln('doing FSeek');
- Writeln('FilSize = ',FSeek(Handle,0,15100):1);
- Done := TestDosErrNo;
- Writeln('doing FSeek again...');
- Writeln('FilSize = ',FSeek(Handle,0,0):1);
- Done := TestDosErrNo;
- Writeln('do ReadFile');
- ReadFile(Handle,SizeOf(Buf),Buf,WBytes);
- Done := TestDosErrNo;
- Writeln('Number of bytes read = ',WBytes:1);
- Writeln('do CloseFile');
- CloseFile(Handle);
- Done := TestDosErrNo;
- end.