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 06:05:13 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!chcgil2-snh1.gtei.net!chcgil2-snf1.gtei.net!news.gtei.net!news.binc.net!kilgallen From: Kilgallen@eisner.decus.org.nospam (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: Variable length string Date: 13 Aug 2001 08:05:09 -0500 Organization: LJK Software Message-ID: References: <9l82gv$j83$1@news.mch.sbs.de> NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 997707359 18225 192.135.80.34 (13 Aug 2001 12:55:59 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Mon, 13 Aug 2001 12:55:59 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:11840 Date: 2001-08-13T08:05:09-05:00 List-Id: 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? > Iam using the below structure > > type list; > type pList is access list; > type list is > record > data:integer; > str:string(1 .. 20); > next:pList:=NULL; > end record; 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.