comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: Get_Line vs Adasockets
Date: 2000/08/14
Date: 2000-08-14T00:00:00+00:00	[thread overview]
Message-ID: <8n975o$546$1@nnrp1.deja.com> (raw)
In-Reply-To: Pine.LNX.4.21.0008141730540.13077-100000@dione.ids.pl

In article <Pine.LNX.4.21.0008141730540.13077-100000@dione.ids.pl>,
  Michal Zalewski <lcamtuf@dione.ids.pl> 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.




  reply	other threads:[~2000-08-14  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-13  0:00 Get_Line vs Adasockets Ultor
2000-08-13  0:00 ` Dale Stanbrough
2000-08-14  0:00   ` Martin Dowie
2000-08-17  0:00     ` tmoran
2000-08-21  0:00       ` Martin Dowie
2000-08-14  0:00 ` Ken Garlington
2000-08-14  0:00   ` Ultor
2000-08-14  0:00     ` Ted Dennison
2000-08-14  0:00       ` Michal Zalewski
2000-08-14  0:00         ` Ted Dennison [this message]
2000-08-21  1:44   ` David Thompson
2000-08-14  0:00 ` Anders Gidenstam
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox