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, MSGID_RANDY 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: Ted Dennison Subject: Re: Get_Line vs Adasockets Date: 2000/08/14 Message-ID: <8n975o$546$1@nnrp1.deja.com>#1/1 X-Deja-AN: 658177200 References: <8n6cbc$9ge$1@news.tpi.pl> <8n8lku$2ks$1@news.tpi.pl> <8n91lo$ek$1@nnrp1.deja.com> X-Http-Proxy: 1.0 x60.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Mon Aug 14 16:36:07 2000 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.7 [en] (WinNT; I) Date: 2000-08-14T00:00:00+00:00 List-Id: In article , Michal Zalewski wrote: > On Mon, 14 Aug 2000, Ted Dennison wrote: > > > > That won't work cause Incoming_Socket is not File_Type ... will work > > > if ther's some way to convert Incoming_Socket to File_Type. > > > > > > Well, the "File" parameter has to be of Ada.Text_IO.File_Type, of > > course. If its not, you are going to have to do something else besides > > Text_IO. > > Well, function Get_Line is overloaded within adasockets package (it's nice > binding, at least for GNAT, available at http://www.infres.enst.fr/ANC/). > Unfortunately, author didn't overloaded Get_Line(socket,string,out > natural), but only Get_Line(socket). So, in case described by Marek, > Get_Line from Ada.Text_IO was called, resulting in type mismatch. His > second attempt caused array size mismatch (because Get_Line(socket) return > buffer length may vary). > > One - obvious - solution is calling Get_Line at declaration time (just > like someone suggested here), other solution are: converting Socket to > Ada.Text_IO.File_Type or writing own Get_Line for sockets. Ahhh. So I presume this version of Get_Line is a function that returns a string? In that case, another option would be to pass its string value straight into Ada.Strings.Unbounded.To_Unbounded_String. eg: Line : Ada.Strings.Unbounded.Unbounded_String; begin ... Line := Ada.Strings.Unbounded.To_Unbounded_String (Get_Line (Socket)); -- T.E.D. http://www.telepath.com/~dennison/Ted/TED.html Sent via Deja.com http://www.deja.com/ Before you buy.