Guest User

Untitled

a guest
Aug 4th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 0.95 KB | None | 0 0
  1. with Ada.Text_IO;
  2. with Ada.Sequential_IO;
  3.  
  4. procedure Test_Driver is
  5.    
  6.    type Interest_Field is
  7.      array(1..10) of Integer;
  8.    type Person_Handling is
  9.       record
  10.      Last_Name : String(1..20);
  11.      First_Name : String(1..20);
  12.      Street : String(1..20);
  13.      Zip_Code : String(1..20);
  14.      Nr_Of_Interests : Integer;
  15.      Interests : Interest_Field;
  16.       end record;
  17.    
  18.    package Person_IO is
  19.       new Ada.Sequential_IO(Element_Type => Person_Handling);
  20.    use Person_IO;
  21.    
  22.    Original : Person_IO.File_Type;
  23.    Output : Ada.Text_IO.File_Type;
  24.    P : Person_Handling;
  25.    
  26. begin
  27.    Open(File => Original,
  28.     Mode => In_File,
  29.     Name => "REG.BIN");
  30.    Create(File => Output,
  31.       Mode => Out_File,
  32.       Name => "OUTPUT.TXT");
  33.    while not End_Of_File(Original) loop
  34.       Read(Original, P);
  35.       Ada.Text_IO.Put(Output, P.Last_Name(1..20));
  36.       Ada.Text_IO.New_Line(2);
  37.    end loop;
  38.    Close(Original);
  39.    Close(Output);
  40. end Test_Driver;
Add Comment
Please, Sign In to add comment