The program below is suppose to get an input of Characters from the user and put it into an Record with the subprogram Procedure Get(Tecken : out Record_Type). The last step is to Print it in the Terminal with another subprogram Procedure Put(Chars : in Chars_Array).
The issue I'm facing is the actual output of the Characters into the Terminal where I get:
procedure Poster is
type Char_Array is -- Fält/Array
array (1..256) of Character;
type Record_Type is -- Post/Record
record
Chars : Char_Array;
Length : Integer;
end record;
procedure Get(Tecken : out Record_Type) is -- Character input
begin
for I in 1..256 loop
Get(Tecken.Chars(I));
exit when End_Of_Line;
end loop;
end Get;
Here is the subprogram that prints the Characters from the Array. I'm confused when it comes to Records and Arrays, but I'm thinking that I need an Array as a inparameter since I can't loop through Records.
procedure Put(Chars : in Char_Array) is -- Character output
begin
for I in 1..256 loop
Put(Chars(I));
end loop;
end Put;
Here is another bump in the road where I use an inparameter "Chars" the Put-Call. Does the Char_Array recognize the input in "Tecken" ?
Tecken : Record_Type;
Chars : Char_Array;
begin
Get(Tecken);
Put(Chars);
end Poster;