comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: Problems with Ada.Text_IO and strings.
Date: Thu, 16 Oct 2003 02:29:14 GMT
Date: 2003-10-16T02:29:14+00:00	[thread overview]
Message-ID: <_nnjb.142245$%h1.142565@sccrnsc02> (raw)
In-Reply-To: mL5jb.3237$Z_2.269599@news20.bellglobal.com

In Ada when you create a string, say:

  S1 : String(1..10)

and pass that string to a procedure, say

  Get_Line( S1, last );

Where Get_Line has the interface defined as:

  procedure Get_Line( str : out String; last : out Natural );

You'll notice that the length of the string is not explicity passed as a
separate item to the procedure.  In Ada the bounds of the array are passed
implicitly.

The Get_Line procedure may use the attributes 'First and 'Last (written
str'First and str'Last respectivly) to obtain the first and last indexes of
the string passed in.  So the implementation of Get_Line can limit the
number of characters read to the size of the string passed in and return the
actual number of characters read in "last".

So in answer to your question the "Get_Line" procedure will make sure that
the string you receive is a length of 10 or less.

Steve
(The Duck)


"CheGueVerra" <chegueverra@hotmail.com> wrote in message
news:mL5jb.3237$Z_2.269599@news20.bellglobal.com...
> It's still not clear for me how to make sure, that when I have a String
> let's say:
>
> S1 : String(1..10);
>
> How can I make sure that the String that I will receive and treat will be
of
> length 10 or less..
>
> I'm still a little n00b
>
> CheGueVerra
>
>
>
>





  parent reply	other threads:[~2003-10-16  2:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-13 22:23 Problems with Ada.Text_IO and strings Bleakcabal
2003-10-13 23:51 ` Larry Hazel
2003-10-14  0:06 ` Chad R. Meiners
2003-10-14 12:32   ` Bleakcabal
2003-10-14 15:03     ` Robert I. Eachus
2003-10-14 15:16       ` Stephane Richard
2003-10-14 20:16         ` Jeffrey Carter
2003-10-14  1:29 ` Jeffrey Carter
2003-10-14 12:39   ` Bleakcabal
2003-10-14 12:57     ` sk
2003-10-14 14:14     ` Problems with Ada.Text_IO and strings. (wants EOL character) Larry Kilgallen
2003-10-14 16:20       ` Stephen Leake
2003-10-14 16:45         ` Stephane Richard
2003-10-14 20:19     ` Problems with Ada.Text_IO and strings Jeffrey Carter
2003-10-14 12:33 ` Bleakcabal
2003-10-15  6:25 ` CheGueVerra
2003-10-15 14:41   ` Martin Krischik
2003-10-15 19:50     ` CheGueVerra
2003-10-15 22:00       ` Ludovic Brenta
2003-10-16  1:19         ` Jeffrey Carter
2003-10-15 23:39       ` Chad R. Meiners
2003-10-19  7:36         ` Martin Krischik
2003-10-19 19:24           ` Chad R. Meiners
2003-10-15 17:23   ` Marius Amado Alves
2003-10-16  2:29   ` Steve [this message]
2003-10-16  5:51     ` CheGueVerra
2003-10-16  9:51       ` CheGueVerra
replies disabled

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