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=2.1 required=5.0 tests=BAYES_20,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c2a8d8ae372fa034 X-Google-Attributes: gid103376,public From: Dale Keim Subject: Re: Using STRING variable Date: 1998/05/20 Message-ID: <356355ED.6D13@roses.bna.boeing.com>#1/1 X-Deja-AN: 355101109 Content-Transfer-Encoding: 7bit Sender: nntp@news.boeing.com (Boeing NNTP News Access) X-Nntp-Posting-Host: esmeralda.roses.bna.boeing.com References: <6jv9mg$e7c$1@news4.isdnet.net> Content-Type: text/plain; charset=us-ascii Organization: Boeing North American Mime-Version: 1.0 Reply-To: keim@roses.bna.boeing.com Newsgroups: comp.lang.ada Date: 1998-05-20T00:00:00+00:00 List-Id: JJ Lallemand wrote: > > Hi, > > First, sorry for my 'bad english' ! > > I am new in programming in ADA (ADA 95) and I have a little problem with > string var. > > Here is a little program : > > ---------------------- > with text_io; use text_io; > > procedure main is > zz : string(1..20); > begin > put(item=>"Enter your name: "); > get(zz); > put_line("hello " & zz); > end main; > ----------------------- > > The problem is that ADA wants exactly 20 characters ! How to enter less > characters ? > > And when I "put" a string to an other ( text2 := text1 ) with text1 : > string (1..20) and text2 : string(1..30), ADA raises a "constraint error" > > Thank you for your help ! > > JJ JJ -- Try this procedure main is zz : string(1..20); zz_length : Natural; begin put(item=>"Enter your name: "); get_line(item => zz, last => zz_length); put_line("hello " & zz(1..zz_length)); end main; -- Dale