home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega CD-ROM 1
/
megacd_rom_1.zip
/
megacd_rom_1
/
MAGAZINE
/
INSIDE_T
/
ITPJAN90.ZIP
/
SHOWLOCK.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-12-15
|
1KB
|
57 lines
PROGRAM ShowLock;
USES Crt,Dos,RecLock,FileUtil;
CONST RecSize = 43;
VAR I,IOTest,TestLock:Integer;
F:FILE OF Byte;
Data:Byte;
PROCEDURE PrintTestLock(I:Integer);
VAR X,Y:Byte;
BEGIN
X:=WhereX;Y:=WhereY;
Write(Chr(219));
GotoXY(X,Y)
END;
BEGIN
ClrScr;
Val(ParamStr(1),FileMode,I);
Assign(F,'testrec.dat');
{$I-}
Reset(F);
{$I+}
IOTest:=IOResult;
IF IOTest=2 THEN
Rewrite(F)
ELSE
IF IOTest <> 0 THEN IOError(IOTest);
WHILE NOT(KeyPressed) DO
BEGIN
GotoXY(1,1);
FOR I:=0 TO (FileSize(F)-1) DO
BEGIN
IF I MOD RecSize = 0 THEN
Write(I DIV RecSize+1:4,': ');
PrintTestLock(I);
TestLock:=recordlock(0,@F,I+1);
IF TestLock=0 THEN
BEGIN
Seek(F,I);
Read(F,Data);
IF Data < 30 THEN Write('*')
ELSE Write(Chr(Data))
END
ELSE
Write('X');
IF I MOD RecSize = RecSize-1 THEN WriteLn;
TestLock:=recordlock(1,@F,I+1);
END;
END;
Close(F)
END.