Ada.Directories.Kind Example

with Ada.Text_IO; 
with Ada.Directories;
 
procedure aDir is
   package IO renames Ada.Text_IO;
   package D renames Ada.Directories;
   package IOE is new Ada.Text_IO.Enumeration_IO (D.File_Kind);
begin
   IO.Put ("Starting default directory: ");
   IO.Put_Line (Item => D.Current_Directory);
 
   IOE.Put (Item => D.Kind (Name => "some_file"));
   IO.New_Line;
   IOE.Put (Item => D.Kind (Name => "some_dir"));
   IO.New_Line;
   IOE.Put (Item => D.Kind (Name => "/dev/sda"));
   IO.New_Line;
   IOE.Put (Item => D.Kind (Name => ""));
 
exception
   when D.Name_Error =>
      IO.Put_Line (Item => "Name_Error raised");
end aDir;

Go back


Navigation