From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,68f91dde523dad6c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 29 Jan 2005 15:03:23 -0600 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Input a string (again) References: <36119gF4r0h1aU2@individual.net> X-Newsreader: Tom's custom newsreader Message-ID: <2dWdnbwA872GZ2bcRVn-gw@comcast.com> Date: Sat, 29 Jan 2005 15:03:23 -0600 NNTP-Posting-Host: 67.161.24.234 X-Trace: sv3-7endHRKoqyLS+WFbOBaIrj19Kyv+/WaILOK6Z/z76HfQnmRRj45Knv/aFWnKvbZKKF8xAkXn3WE4N/6!4mvx9/CTgQXvOcG6tGA9CwFQ74Yv3Xg8uNswPELxJpkjcLWK4mZy7IsfhLtssQ== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.22 Xref: g2news1.google.com comp.lang.ada:8073 Date: 2005-01-29T15:03:23-06:00 List-Id: > After I'm now able to input a string (30 chars), > ... > Get_Line(sString, iString_Length); > ... > return sString; "Get_Line" really ought to be renamed "Read_Into_Buffer" or something. Don't think of sString as your input string, think of it as a buffer that will hold up to 30 characters of input. The actual string typed in by the user is in the first iString_Length positions in the buffer, so sString(1 .. iString_Length) is the typed input. BTW, in Ada strings don't necessarily have to start with an index of 1. For instance, a procedure might be called with a string parameter which is position 5 .. 10 of some larger string. So it's safer to be in the habit of not assuming a start index of 1. Thus you should have: Get_Line(sString, iString_Last); and return sString(sString'first .. iString_Last);