home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog4 / biseqout.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  778 b   |  44 lines

  1.                                        -- Chapter 22 - Program 1
  2. with Text_IO;
  3. use Text_IO;
  4. with Sequential_IO;
  5.  
  6. procedure BiSeqOut is
  7.  
  8.    type MY_REC is
  9.       record
  10.          Age     : INTEGER;
  11.          Sex     : CHARACTER;
  12.          Initial : CHARACTER;
  13.       end record;
  14.  
  15.    package Seq_IO is new Sequential_IO(MY_REC);
  16.    use Seq_IO;
  17.  
  18.    Myself      : MY_REC;
  19.    My_Out_File : Seq_IO.FILE_TYPE;
  20.  
  21. begin
  22.  
  23.    Create(My_Out_File, Out_File, "NAMEFILE.TXT");
  24.  
  25.    Myself.Sex := 'M';
  26.    Myself.Initial := 'X';
  27.  
  28.    for Index in 1..100 loop
  29.       Myself.Age := Index;
  30.       Write(My_Out_File, Myself);
  31.    end loop;
  32.  
  33.    Close(My_Out_File);
  34.  
  35. end BiSeqOut;
  36.  
  37.  
  38.  
  39.  
  40. -- Result of Execution
  41.  
  42. --   (The only output is a binary file named NAMEFILE.TXT)
  43.  
  44.