GNAT.Directory_Operations Example


-- GNAT.Directory_Operations Example
--
-- GNAT.Directory_Operations provides routines for manipulating Directories

with GNAT.IO; use GNAT.IO;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.IO_Aux; use GNAT.IO_Aux;

procedure test_dir is
   Test_Dir           : Dir_Type;
   Test_String        : String(1..255);
   Test_String_Length : Natural;
begin
   Put("Display directory :");

   declare
      Test_Name : String := Get_Line;
   begin
      -- If you want to change to the dir
      -- Change_Dir(Test_Name);

      Put_Line("Open directory : " & Test_Name);
      Open(Test_Dir, Test_Name);
   end;

   loop
      Read(Test_Dir, Test_String, Test_String_Length);
      exit when Test_String_Length = 0;
      Put_Line(Test_String(1 .. Test_String_Length));
   end loop;

end test_dir;

Contributed by: David Botton
Contributed on: May 18, 1999
License: Public Domain

Back