comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephe.Leake@nasa.gov>
To: comp.lang.ada@ada-france.org
Subject: Re: count_string program
Date: 27 Feb 2004 08:28:59 -0500
Date: 2004-02-27T08:28:59-05:00	[thread overview]
Message-ID: <mailman.35.1077890849.327.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <403db7ee$1_1@news.tm.net.my>

Cecilia Chew <cecilia@nowhere.com> writes:

> Hi all,
> I am doing a program that will count the input characters from user.
> There is a problem that I can't solve.
> Problem is : since I'm going to count the characters. So, I can't ask
> user how many characters they want to input. Compilation error come
> and mention that the string need to be constrainted.
> How am I going to constraint the string type since I don't know how
> many characters user going to input.

See Ada.Text_IO.Get_Line.

For that, you need to know in advance the maximum number of characters
the user might enter.

Or, if you are using GNAT, see Ada.Strings.Unbounded.Text_IO (not a
standard Ada package). Then you don't need a max in advance.

-- 
-- Stephe




      parent reply	other threads:[~2004-02-27 13:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-26  9:10 count_string program Cecilia Chew
2004-02-26 10:17 ` Jacob Sparre Andersen
2004-02-27  3:13   ` Cecilia Chew
2004-02-27 11:00     ` Jacob Sparre Andersen
2004-02-26 15:43 ` Björn Persson
2004-02-27  3:19   ` Cecilia Chew
2004-02-27  6:49     ` tmoran
2004-02-27 18:29       ` Björn Persson
2004-02-27 13:28 ` Stephen Leake [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox