*/
Love this site? Hate it? Leave us some comments.
*/

View \BINOUT.PAS

This is the second disk of the PASCAL TUTOR system. It has the

Submitted By: WEBMASTER
Rating: (Not rated) (Rate It)


(* Chapter 11 - Program 6 *)
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 *)

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.