Bonjour ,
Tout est dans le titre du sujet .
Le code compile puis crash a l'éxécution
raised ADA.IO_EXCEPTIONS.END_ERROR : a-tigeli.adb:96
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| with Ada.Text_IO.Unbounded_IO ; use Ada.Text_IO.Unbounded_IO ;
with Ada.Strings.Unbounded ; use Ada.Strings.Unbounded ;
with Ada.Text_IO ; use Ada.Text_IO ;
Procedure main is
this_file : File_Type ;
next_line : Positive_Count := 1 ;
Type T_Tableau is array(1..1_000) of unbounded_string ;
phrases : T_Tableau ;
Begin
Open
(Mode => In_file ,
File => this_file ,
Name => "main.adb" ) ;
loop
exit when End_Of_File ( this_file ) ;
Set_Line ( this_file , next_line );
if next_line > 1 then
for i in 1 .. 1_000 loop
phrases(i) := get_line ( this_file ) ;
end loop ;
end if ;
next_line := next_line + 1 ;
end loop ;
Close ( this_file ) ;
Open
(Mode => Out_file ,
File => this_file ,
Name => "main.adb" ) ;
for i in 1..1_000 loop
put ( this_file , phrases(i) ) ;
end loop ;
Close ( this_file ) ;
end main ; |
Partager