In procedure Read_File (util-files.adb), add Into := Null_Unbounded_String;
procedure Read_File (Path : in String;
Into : out Unbounded_String;
Max_Size : in Natural := 0) is
use Ada.Streams;
use Ada.Streams.Stream_IO;
F : File_Type;
Buffer : Stream_Element_Array (1 .. 10_000);
Pos : Positive_Count := 1;
Last : Stream_Element_Offset;
Space : Natural;
begin
Into := Null_Unbounded_String;
if Max_Size = 0 then
Space := Natural'Last;
else
Space := Max_Size;
end if;
Yes, another option could be to declare the Content parameter as in out and make it clear that the Read_File procedure appends the file content to the target unbounded string.
The code
The output
Expected result
Cause
out parameter not initialized
Solution
In procedure Read_File (util-files.adb), add Into := Null_Unbounded_String;
alr
alr with utilada
Source
https://stackoverflow.com/questions/40621326/ada-out-parameter