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=-0.9 required=5.0 tests=BAYES_00,FROM_NUMERIC_TLD, XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fa4a527ee1c9d1e6,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!newsfeed.stueberl.de!dedekind.zen.co.uk!zen.net.uk!demorgan.zen.co.uk!diablo.theplanet.net!news.theplanet.net!not-for-mail From: "Makhno" Newsgroups: comp.lang.ada Subject: Using fwrite in Ada Date: Wed, 10 Aug 2005 18:01:58 +0100 Message-ID: NNTP-Posting-Host: 81.76.191.252 X-Trace: newsm1.svr.pol.co.uk 1123693341 8022 81.76.191.252 (10 Aug 2005 17:02:21 GMT) NNTP-Posting-Date: 10 Aug 2005 17:02:21 GMT X-Complaints-To: abuse@theplanet.net X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Xref: g2news1.google.com comp.lang.ada:4065 Date: 2005-08-10T17:02:21+00:00 List-Id: Hello, I want to read and write binary data from stdin/stdout, unfortunately Ada's usual IO routines appear to be text only and (on Win32) convert code 10 to codes 10 & 13. To get round this I'm trying to use Interfaces.C_Streams, but I don't know enough Ada to get them working. How to I get a String into the fwrite function? I tried procedure MainCode is cptr : chars_ptr; Buffer : String (1..100); vptr : voids; begin -- fill Buffer with binary data here cptr:=New_String(Buffer); vptr:=voids(cptr); fwrite(vptr,100,1,stdout); end; But this won't compile, the compiler says that it cannot convert the chars_ptr to voids. Coming from a C background, I don't understand why something cannot be cast to void. Does anybody have any idea as to how I get binary data onto stdout? Thanks