Implemented checking if file even exists

This commit is contained in:
Bartłomiej Szostak 2024-04-20 15:30:12 +02:00
parent 4e9da4233f
commit ce51ce0b19
No known key found for this signature in database
GPG Key ID: 562DACF230A18086

View File

@ -1,6 +1,7 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Sequential_IO;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Directories;
procedure sillymachine is
type Byte is mod 256;
@ -8,7 +9,7 @@ procedure sillymachine is
type ByteArr is array (Integer range <>) of Byte;
F : Bin_IO.File_Type;
FileName : String (1 .. 255);
FileName : String (1 .. 255) := (others => ascii.nul);
FileNameLength : Integer := 0;
ValidHeader : ByteArr (0 .. 15);
Arr : ByteArr (0 .. 15);
@ -62,4 +63,6 @@ begin
Put_Line("Header passed");
<< THE_END >>
exception
when Name_Error => New_Line(1); Put("Error: File '"); Put(FileName); Put_Line("' does not exist!"); New_Line(1);
end sillymachine;