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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,57b537327d52e653 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!bcklog2.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 02 Aug 2007 15:27:51 -0500 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Byte streams References: <1186082475.711489.104420@e9g2000prf.googlegroups.com> X-Newsreader: Tom's custom newsreader Message-ID: Date: Thu, 02 Aug 2007 15:27:51 -0500 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 24.6.140.189 X-Trace: sv3-m5P1KgfGFifG60DKHk3SMpkXB4VRuC6U+scXX3dmpoHs1ht3UUM7OhVBRUo6rIesllUHKgS4s/E2ECM!xVHw6CuUTpLfBS6zEOtqeEtN2FQrvjPI+0c1kd2AyHHEoLF/JoNX3TJSv0N6t3DxSuDXEADJm9Jk!xwj3GZOTt4jNFCd5o0XSZ2k31KZn X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.35 Xref: g2news2.google.com comp.lang.ada:1332 Date: 2007-08-02T15:27:51-05:00 List-Id: > 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");