Plik Na Ekran
with Ada.Text_Io; use Ada.Text_Io; with Ada.Integer_Text_Io; use Ada.Integer_Text_Io; with Ada.Command_Line; use Ada.Command_Line; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure Cat is Plik : File_Type; Litera : Character; LiczbaArgumentow : Natural; Nazwa : Unbounded_String; begin if (Argument_Count /= 0) then LiczbaArgumentow := Argument_Count; Put ("Podales do programu: "); Put (Command_Name); Put (" argumenty"); New_Line; for ThisArgument in 1 .. LiczbaArgumentow loop Put ( "Numer argumentu: "); Put (ThisArgument); Put (" jest nim: "); Put (Argument(ThisArgument)); New_Line; end loop; for ThisArgument in 1 .. LiczbaArgumentow loop Nazwa := To_Unbounded_String (Argument (ThisArgument)); Open (Plik, In_File, To_String (Nazwa)); New_Line; Put ("Nastepny plik o nazwie: "); Put (Argument (ThisArgument)); New_Line (2); loop exit when End_Of_File (Plik); Get (Plik, Litera); Put (Litera); if End_Of_Line (Plik) then New_Line; end if; end loop; Close (Plik); end loop; else Put ("Nie podales argumentow"); end if; end Cat;
Podobne strony
wersja strony: 2, ostatnia edycja: 18 Jul 2009 10:23