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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,223af7b95794ff28 X-Google-Attributes: gid103376,public From: d96andgi@dtek.chalmers.se (Anders Gidenstam) Subject: Re: Get_Line vs Adasockets Date: 2000/08/14 Message-ID: #1/1 X-Deja-AN: 658079534 References: <8n6cbc$9ge$1@news.tpi.pl> X-Complaints-To: abuse@chalmers.se X-Trace: nyheter.chalmers.se 966250883 4562 129.16.193.234 (14 Aug 2000 11:01:23 GMT) Organization: Chalmers University of Technology NNTP-Posting-Date: 14 Aug 2000 11:01:23 GMT Newsgroups: comp.lang.ada Date: 2000-08-14T11:01:23+00:00 List-Id: In article <8n6cbc$9ge$1@news.tpi.pl>, "Ultor" writes: >Hello > >I'm new in ADA (code since Friday). I got a problem with Get_Line in my >source. I tried to make it working over 2 hours and still got a problem with >that. > >When i did Get_Line like this > > BUF := Get_Line(Incoming_Socket); > >then I had problem with CONSTRAINT_ERROR. I don't know how to set size of >BUF to be the same as line from Get_Line (as I know that should eliminate >CONSTRAINT_ERROR). Hello! Well, that statement will only work if BUF and the string Get_Line returns both have the same length... One way to solve this problem is to use a declare-block, ie not declaring BUF until you know how large it needs to be: declare BUF : String := Get_Line(Incoming_Socket); begin -- Do stuff that uses BUF. end; Another way is to process the data in a procedure or function: procedure Do_Stuff (BUF : String) is ... And in your program you call it with Get_Line as a parameter: ... Do_Stuff (BUF => Get_Line (Incoming_Socket)); ... Regards Anders -- "A well-written program is its own heaven; a poorly-written program is its own hell." - The Tao of Programming