comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Finding the end of a stream from a socket
Date: Sun, 22 Oct 2017 15:28:18 +0200
Date: 2017-10-22T15:28:18+02:00	[thread overview]
Message-ID: <osi6dj$1e2h$1@gioia.aioe.org> (raw)
In-Reply-To: f9a1afdc-00d9-452e-aecf-b51c14cb925e@googlegroups.com

On 2017-10-22 14:26, Andrew Shvets wrote:

> One more question.  How do I convert a string to a Stream_Element?
> 
> This is what I have:
> 
>    Out_String : constant String := "I like cake!";
>    Out_Data : Ada.Streams.Stream_Element_Array(1 .. 12);
> begin
> ...
>    for elem in 1 .. Out_Data'Length loop
>      Out_Data(Ada.Streams.Stream_Element_Offset(elem)) :=
>        Ada.Streams.Stream_Element(Character'Val(Out_String(elem)));
>    end loop;

    Out_String : constant String := ...;
    Out_Data   : constant Stream_Element_Array (1..Out_String'Length);
begin
    for Octet in Out_Data'Range loop
       Out_Data (Octet) :=
          Character'Pos (Out_String (Integer(Octet-1)+Out_String'First));
    end loop;


-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  parent reply	other threads:[~2017-10-22 13:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-21  2:05 Finding the end of a stream from a socket Andrew Shvets
2017-10-21  8:44 ` Dmitry A. Kazakov
2017-10-21 13:45   ` Andrew Shvets
2017-10-21 18:11     ` Dennis Lee Bieber
2017-10-21 19:19       ` Dmitry A. Kazakov
2017-10-21 19:46         ` Andrew Shvets
2017-10-22 12:26         ` Andrew Shvets
2017-10-22 12:28           ` Andrew Shvets
2017-10-22 13:28           ` Dmitry A. Kazakov [this message]
2017-10-21 17:34   ` Andrew Shvets
2017-10-21 19:18     ` Andrew Shvets
replies disabled

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