From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2ed1f845799e1cd8 X-Google-Attributes: gid103376,public From: "Frank J. Lhota" Subject: Re: Problems with Last statment .... Date: 2000/03/14 Message-ID: #1/1 X-Deja-AN: 597434362 References: <38ce6681.0@news.per.paradox.net.au> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Trace: client 953057735 38.163.203.81 (Tue, 14 Mar 2000 13:15:35 EST) X-MSMail-Priority: Normal NNTP-Posting-Date: Tue, 14 Mar 2000 13:15:35 EST Newsgroups: comp.lang.ada Date: 2000-03-14T00:00:00+00:00 List-Id: "Defiant" wrote in message news:38ce6681.0@news.per.paradox.net.au... > hi im writing a program for a uni assignment and it is complete and works > yet i have set the string type to a min of 1 to a max of 20 characters for a > name input... > > the problem i am having is i am using the Get_Line(Name, Last) statement to > get the name they feed in and the Put(Name); procedure to output... the > problem is ada compiler grabs whatever extra numerals hex and garbage that > is left in RAM to fill the extra places between 1 and 20... that the name > that was input doesnt fill .... > > > any suggestions ... > > Thanks > > > The call Get_Line(Name, Last) returns the most recently read line in Name( 1 .. Last ). For example, if the next line is "Hello", then the call Get_Line(Name, Last) will set Last to 5 and set Name( 1 .. 5 ) to "Hello". Any character in Name after Name( Last ) is garbage, and therefore should not be output. To write only the characters that were actually in the input line, try the call Put ( Name( 1 .. Last ) ); If you want to output the name right padded to 20 characters, you could do the following: Name ( Last + 1 .. Name'Last ) := ( others => ' '); -- Blank out the unread portion. Put ( Name ); Hope this helps.