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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4c049fca34123e80 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-13 13:04:11 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!howland.erols.net!news-out.worldnet.att.net.MISMATCH!wn3feed!worldnet.att.net!135.173.83.71!wnfilter1!worldnet-localpost!bgtnsc06-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3B783354.9D873109@worldnet.att.net> From: James Rogers X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Variable length string References: <9l82gv$j83$1@news.mch.sbs.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 13 Aug 2001 20:04:10 GMT NNTP-Posting-Host: 12.86.36.138 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc06-news.ops.worldnet.att.net 997733050 12.86.36.138 (Mon, 13 Aug 2001 20:04:10 GMT) NNTP-Posting-Date: Mon, 13 Aug 2001 20:04:10 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:11867 Date: 2001-08-13T20:04:10+00:00 List-Id: Larry Kilgallen wrote: > > In article <9l82gv$j83$1@news.mch.sbs.de>, "Shitij" 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