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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,79db4ff72bff9422 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-25 05:46:43 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!isdnet!enst!enst.fr!not-for-mail From: "David C. Hoos" Newsgroups: comp.lang.ada Subject: Re: How to convert record? Date: Thu, 25 Oct 2001 07:48:32 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <80d2e34.0110210156.7918cd3d@posting.google.com> <3bd402f9.8783319@news.demon.co.uk> <80d2e34.0110250340.155ae0b7@posting.google.com> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1004014002 75826 137.194.161.2 (25 Oct 2001 12:46:42 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 25 Oct 2001 12:46:42 +0000 (UTC) To: Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:15180 Date: 2001-10-25T07:48:32-05:00 Presumably, you know the size of the record. In your original post you showed a record with 8 bytes. So, you would declare a constrained string subtype of the correct size e.g., subtype Record_String is POSIX.POSIX_String (1 .. 8); Now you can instantiate Unchecked_Conversion from the Record to Record_String, because Record_String is constrained. A Record_String is a valid buffer to pass to POSIX.IO.Read. ----- Original Message ----- From: "Joseph Kwan" Newsgroups: comp.lang.ada To: Sent: Thursday, October 25, 2001 6:40 AM Subject: Re: How to convert record? > john.mccabe@emrad.com.nospam (John McCabe) wrote in message news:<3bd402f9.8783319@news.demon.co.uk>... > > On 21 Oct 2001 02:56:25 -0700, joseph_kwan@greenlime.com (Joseph Kwan) > > wrote: > > > > >I want to send a command buffer to serial port using florist's POSIX > > >interface but I have encountered problems in converting record to > > >POSIX.IO.IO_Buffer or Ada.Streams.Stream_Element_Array. How can I > > >overcome this problem? > > > > Without looking at the Reference Manual, I would initially suggest > > looking at Ada.Unchecked_Conversion to do the job. > > > I thought that would work too but theoretically, > Ada.Unchecked_Conversion will not work in converting record to > POSIX.IO.IO_Buffer which is a string of characters (See spec in > florist's implementation). > > Anyhow I tried to do Unchecked_Conversion and gnat gave me error > message: > > "unchecked conversion to unconstrained array not allowed". > > What should I do? > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada >