* Using STRING variable
@ 1998-05-20 0:00 JJ Lallemand
1998-05-20 0:00 ` Dale Keim
1998-05-21 0:00 ` Using STRING variable (in French) Jean-Pierre Rosen
0 siblings, 2 replies; 4+ messages in thread
From: JJ Lallemand @ 1998-05-20 0:00 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Using STRING variable
1998-05-20 0:00 Using STRING variable JJ Lallemand
@ 1998-05-20 0:00 ` Dale Keim
1998-05-21 0:00 ` John McCabe
1998-05-21 0:00 ` Using STRING variable (in French) Jean-Pierre Rosen
1 sibling, 1 reply; 4+ messages in thread
From: Dale Keim @ 1998-05-20 0:00 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Using STRING variable
1998-05-20 0:00 ` Dale Keim
@ 1998-05-21 0:00 ` John McCabe
0 siblings, 0 replies; 4+ messages in thread
From: John McCabe @ 1998-05-21 0:00 UTC (permalink / raw)
Dale Keim <keim@roses.bna.boeing.com> wrote:
>JJ Lallemand wrote:
>>
I see Dale has forgotten the subtle correction here:-
>> I am new in programming in ADA (ADA 95) and I have a little problem
Ada - not ADA ;-)
--
Best Regards
John McCabe
=====================================================================
Any opinions expressed are mine and based on my own experience. They
should in no way be taken as the opinion of anyone I am currently
working with, or of the company I am currently working for.
If you have a problem with anything I say, SPEAK TO ME!
(remove "nospam." to reply by e-mail)
=====================================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Using STRING variable (in French)
1998-05-20 0:00 Using STRING variable JJ Lallemand
1998-05-20 0:00 ` Dale Keim
@ 1998-05-21 0:00 ` Jean-Pierre Rosen
1 sibling, 0 replies; 4+ messages in thread
From: Jean-Pierre Rosen @ 1998-05-21 0:00 UTC (permalink / raw)
JJ Lallemand a �crit dans le message <6jv9mg$e7c$1@news4.isdnet.net>...
>Hi,
>
>First, sorry for my 'bad english' !
Je rappelle aux francophones de ce groupe qu'il existe un groupe de
discussion en fran�ais:
fr.comp.lang.ada
--
----------------------------------------------------------------------------
J-P. Rosen (Rosen.Adalog@wanadoo.fr)
Visit Adalog's web site at http://perso.wanadoo.fr/adalog
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1998-05-21 0:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-20 0:00 Using STRING variable JJ Lallemand
1998-05-20 0:00 ` Dale Keim
1998-05-21 0:00 ` John McCabe
1998-05-21 0:00 ` Using STRING variable (in French) Jean-Pierre Rosen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox