From: Dale Keim <keim@roses.bna.boeing.com>
Subject: Re: Using STRING variable
Date: 1998/05/20
Date: 1998-05-20T00:00:00+00:00 [thread overview]
Message-ID: <356355ED.6D13@roses.bna.boeing.com> (raw)
In-Reply-To: 6jv9mg$e7c$1@news4.isdnet.net
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
next prev parent reply other threads:[~1998-05-20 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-05-20 0:00 Using STRING variable JJ Lallemand
1998-05-20 0:00 ` Dale Keim [this message]
1998-05-21 0:00 ` John McCabe
1998-05-21 0:00 ` Using STRING variable (in French) Jean-Pierre Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox