3
{ Program to demonstrate the fdRead and fdTruncate functions. }
7
Const Data : string[10] = '1234567890';
13
FD:=fpOpen('test.dat',o_wronly or o_creat,&666);
16
{ Fill file with data }
18
if fpWrite (FD,Data[1],10)<>10 then
20
writeln ('Error when writing !');
24
FD:=fpOpen('test.dat',o_rdonly);
29
if fpRead (FD,Data[1],10)<>10 then
31
Writeln ('Error when Reading !');
35
{ Truncating file at 60 bytes }
36
{ For truncating, file must be open or write }
37
FD:=fpOpen('test.dat',o_wronly,&666);
40
if fpfTruncate(FD,60)<>0 then
41
Writeln('Error when truncating !');