Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 1.41 KB | None | 0 0
  1. WITH Ada.Text_IO.Unbounded_IO ; USE Ada.Text_IO.Unbounded_IO ;
  2. WITH Ada.Strings.Unbounded ;    USE Ada.Strings.Unbounded ;
  3. WITH Ada.Text_IO  ;             USE Ada.Text_IO  ;
  4. WITH PragmARC.Text_IO ;
  5.  
  6. Procedure main is
  7.  
  8.   this_file , test_file : PragmARC.Text_IO.File_Handle ;
  9.  
  10.   count : integer := 0 ;
  11.  
  12. Begin
  13.  
  14.     PragmARC.Text_IO.Set_Line_Terminator( PragmARC.Text_IO.Unix_EOL );
  15.  
  16.     PragmARC.Text_IO.Open
  17.      (File => this_file ,
  18.       Mode => In_file ,
  19.       Name => "main.adb");
  20.  
  21.    loop exit when PragmARC.Text_IO.End_Of_File( this_file );
  22.      PragmARC.Text_IO.skip_line( this_file );
  23.      count := count + 1 ;
  24.    end loop ;
  25.  
  26.     PragmARC.Text_IO.Create
  27.      (File => test_file ,
  28.       Mode => Out_File ,
  29.       Name => "TEST/fanzine.adb");
  30.  
  31.    declare
  32.  
  33.    Type Tableau_lines_file is array( 1 .. count) of Unbounded_String;
  34.  
  35.    case_array : Tableau_lines_file ;
  36.  
  37.    begin
  38.  
  39.    PragmARC.Text_IO.Close( this_file );
  40.  
  41.    PragmARC.Text_IO.Open
  42.      (File => this_file ,
  43.       Mode => In_file ,
  44.       Name => "main.adb");
  45.  
  46.     Loop exit when PragmARC.Text_IO.End_Of_File( this_file );
  47.         for i in 1..case_array'Length loop
  48.          case_array(i):= To_Unbounded_String( PragmARC.Text_IO.get_line( this_file ) );
  49.        end loop ;
  50.    End loop;
  51.  
  52.     for j in 1..case_array'Length loop
  53.       PragmARC.Text_IO.put_line( test_file , To_String(case_array(j) ) );
  54.    end loop;
  55.  
  56.     end;
  57. End main;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement