comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Byte streams
Date: Thu, 02 Aug 2007 15:27:51 -0500
Date: 2007-08-02T15:27:51-05:00	[thread overview]
Message-ID: <WOmdnSHsoafaoy_bnZ2dnUVZ_vWtnZ2d@comcast.com> (raw)
In-Reply-To: 1186082475.711489.104420@e9g2000prf.googlegroups.com

> type AnotherStructure is record
>     a : Integer;
>     b : Integer;
>     c : Integer;
> end Record;
>
> toByteStream is new Unchecked_Conversion
>     (source => AnotherStructure, Target => ByteStream);
>
> however ByteStream is unconstrained...
>
> Any suggestions?

   1) Either use, or look at the source code of, one or more of the
      multiple Ada socket implementations available on the internet.

   2) Assuming Integer is 4 bytes,
      subtype External_AnotherStructure is Bytestream(1 .. 12);
      toByteStream is new Unchecked_Conversion
          (source => AnotherStructure, Target => External_AnotherStructure);

   3) If you send AnotherStructure a lot, and assuming Integer is 4 bytes,
      procedure send_AnotherStructure (data : AnotherStructure;
                                       numBytes : Integer => 12);
      pragma import (C, send_AnotherStructure, "sendBytes");



  parent reply	other threads:[~2007-08-02 20:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-02 19:21 Byte streams shaunpatterson
2007-08-02 20:18 ` Gautier
2007-08-02 20:27 ` tmoran [this message]
2007-08-02 21:44   ` Robert A Duff
2007-08-02 22:45     ` tmoran
2007-08-02 22:54       ` shaunpatterson
2007-08-03  5:34 ` Jeffrey R. Carter
2007-08-03 13:15   ` shaunpatterson
2007-08-10 20:22     ` Simon Wright
replies disabled

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