comp.lang.ada
 help / color / mirror / Atom feed
From: James Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: Variable length string
Date: Mon, 13 Aug 2001 20:04:10 GMT
Date: 2001-08-13T20:04:10+00:00	[thread overview]
Message-ID: <3B783354.9D873109@worldnet.att.net> (raw)
In-Reply-To: h8LhwUvoK5bn@eisner.encompasserve.org

Larry Kilgallen wrote:
> 
> In article <9l82gv$j83$1@news.mch.sbs.de>, "Shitij" <shitij.sah@sisl.co.in> writes:
> > Hi,
> > Iam new to ADA.I just wanted to know how do you define a variable length
> > string.I have declared a string array of length say a size of 20.But if I
> > use get and pass this string as an arguement,then unless and until I fill
> > this with exactly 20 characters my program is not working.How to overcome
> > this?
 (code snipped)
> My suggestion would be to consider the use of a discriminated record
> (that term should be in the index of your textbook).  That way you
> can make each string be exactly the right length.  You should have
> a separate large string for a buffer to do the initial Get call for
> each string.  Once you have received it, you know the proper length.

Another possibility is to use the Ada.Strings.Bounded package to create
a string type with a maximum size.

Jim Rogers
Colorado Springs, Colorado USA



  reply	other threads:[~2001-08-13 20:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-13  8:19 Variable length string Shitij
2001-08-13 10:20 ` Petter Fryklund
2001-08-13 10:40 ` Des Walker
2001-08-13 14:31   ` Des Walker
2001-08-13 15:07     ` Larry Kilgallen
2001-08-13 13:05 ` Larry Kilgallen
2001-08-13 20:04   ` James Rogers [this message]
2001-08-14  3:18 ` DuckE
2001-08-15 21:27 ` file13
replies disabled

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