Implemented checking if file even exists
This commit is contained in:
parent
4e9da4233f
commit
ce51ce0b19
@ -1,6 +1,7 @@
|
|||||||
with Ada.Text_IO; use Ada.Text_IO;
|
with Ada.Text_IO; use Ada.Text_IO;
|
||||||
with Ada.Sequential_IO;
|
with Ada.Sequential_IO;
|
||||||
with Ada.Command_Line; use Ada.Command_Line;
|
with Ada.Command_Line; use Ada.Command_Line;
|
||||||
|
with Ada.Directories;
|
||||||
|
|
||||||
procedure sillymachine is
|
procedure sillymachine is
|
||||||
type Byte is mod 256;
|
type Byte is mod 256;
|
||||||
@ -8,7 +9,7 @@ procedure sillymachine is
|
|||||||
type ByteArr is array (Integer range <>) of Byte;
|
type ByteArr is array (Integer range <>) of Byte;
|
||||||
|
|
||||||
F : Bin_IO.File_Type;
|
F : Bin_IO.File_Type;
|
||||||
FileName : String (1 .. 255);
|
FileName : String (1 .. 255) := (others => ascii.nul);
|
||||||
FileNameLength : Integer := 0;
|
FileNameLength : Integer := 0;
|
||||||
ValidHeader : ByteArr (0 .. 15);
|
ValidHeader : ByteArr (0 .. 15);
|
||||||
Arr : ByteArr (0 .. 15);
|
Arr : ByteArr (0 .. 15);
|
||||||
@ -62,4 +63,6 @@ begin
|
|||||||
Put_Line("Header passed");
|
Put_Line("Header passed");
|
||||||
|
|
||||||
<< THE_END >>
|
<< THE_END >>
|
||||||
|
exception
|
||||||
|
when Name_Error => New_Line(1); Put("Error: File '"); Put(FileName); Put_Line("' does not exist!"); New_Line(1);
|
||||||
end sillymachine;
|
end sillymachine;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user