AdaPower Logged in as Guest
Ada Tools and Resources

Ada 95 Reference Manual
Ada Source Code Treasury
Bindings and Packages
Ada FAQ


Join >
Home >
Articles >
Getting Started >
Ada FAQ >
Source Treasury >
Books & Tutorials >
Packages for Reuse >
Latest Additions >
Ada Projects >
Press Releases >
Ada Audio / Video >
Home Pages >
Links >
Contact >
About >
Login >
Back
GNAT.Directory_Operations Example (David Botton)

-- 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;


(c) 1998-2004 All Rights Reserved David Botton