home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PASSRC.ZIP / BINOUT.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-04  |  986b  |  43 lines

  1.                                 (* Chapter 11 - Program 6 *)
  2. program Binary_Output_Example;
  3.  
  4. type Dat_Rec = record
  5.        Count : integer;
  6.        Size  : real;
  7.        Name  : string[30];
  8.      end;
  9.  
  10. var Output_File : file of Dat_Rec;
  11.     Dog_Food    : array[1..20] of Dat_Rec;
  12.     Index       : byte;
  13.  
  14. begin  (* main program *)
  15.    Assign(Output_File,'KIBBLES.BIT');
  16.    Rewrite(Output_File);
  17.  
  18.    for Index := 1 to 20 do begin
  19.       Dog_Food[Index].Count := Index;
  20.       Dog_Food[Index].Size := 12345.6789;
  21.       Dog_Food[Index].Name := 'Large size Kibbles & Bits';
  22.    end;
  23.  
  24.    Writeln('Begin outputting data');
  25.    for Index := 1 to 20 do
  26.       Write(Output_File,Dog_Food[Index]);
  27.    Close(Output_File);
  28.    Writeln('End of output');
  29. end.  (* of main program *)
  30.  
  31.  
  32.  
  33.  
  34. { Result of execution
  35.  
  36. Begin outputting data
  37. End of output
  38.  
  39. (In addition to the above output to the monitor, the file
  40.  named KIBBLES.BIT is created and filled with binary data.)
  41.  
  42. }
  43.