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, T_FILL_THIS_FORM_SHORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6c13cc000274246b X-Google-Attributes: gid103376,public From: Dale Stanbrough Subject: Re: Please Help. Date: 1997/09/09 Message-ID: <5v2qk5$cpu$1@goanna.cs.rmit.edu.au>#1/1 X-Deja-AN: 271172255 Distribution: world References: <01bcbcde$f8a425c0$ca70fe8c@default> X-XXMessage-ID: Organization: Royal Melbourne Institute of Technology Newsgroups: comp.lang.ada Date: 1997-09-09T00:00:00+00:00 List-Id: "with Text_IO; use Text_IO; Procedure GetName is Name : String(1..12); begin Put("Please enter name : "); Get(Name); end GetName; Simple answer: with Text_IO; use Text_IO; Procedure GetName is Name : String(1..12); Last : Natural; begin Put ("Please enter name : "); Get_Line (Name, Last); Put ("Hello "); Put_Line (Name (1..Last)); end GetName; Long answer: If you want to deal with variable length data like this (esp store it in a record) then use an appropriate type, rather than string, e.g. Unbounded_String. with Text_IO; use Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Unbounded_IO; use Unbounded_IO; Procedure GetName is Name : Unbounded_String; begin Put ("Please enter name : "); Get_Line (Name); Put ("Hello "); Put_Line (Name); end GetName; (note that Unbounded_IO is a simple package that i wrote). In my experience variable length string handling is one thing that has turned students off Ada a lot. Unbounded_String is a godsend in this respect. It's a pity that a standard I/O package wasn't defined in the standard for this type. Dale