program Binary_Output_Example;type Dat_Rec = record
Count : integer;
Size : real;
Name : string[30];
end;var Output_File : file of Dat_Rec;
Dog_Food : array[1..20] of Dat_Rec;
Index : byte;begin (* main program *)
Assign(Output_File,'KIBBLES.BIT');
Rewrite(Output_File);for Index := 1 to 20 do begin
Dog_Food[Index].Count := Index;
Dog_Food[Index].Size := 12345.6789;
Dog_Food[Index].Name := 'Large size Kibbles & Bits';
end;Writeln('Begin outputting data');
for Index := 1 to 20 do
Write(Output_File,Dog_Food[Index]);
Close(Output_File);
Writeln('End of output');
end. (* of main program *)
Result of execution
Begin outputting data
End of output(In addition to the above output to the monitor, the file
named KIBBLES.BIT is created and filled with binary data.)