comp.lang.ada
 help / color / mirror / Atom feed
From: "Makhno" <root@127.0.0.1>
Subject: Using fwrite in Ada
Date: Wed, 10 Aug 2005 18:01:58 +0100
Date: 2005-08-10T17:02:21+00:00	[thread overview]
Message-ID: <dddbut$7qm$1@newsm1.svr.pol.co.uk> (raw)

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







             reply	other threads:[~2005-08-10 17:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-10 17:01 Makhno [this message]
2005-08-10 17:28 ` Using fwrite in Ada Georg Bauhaus
2005-08-10 18:05 ` Martin Krischik
2005-08-11 17:01 ` tmoran
2005-08-11 21:59   ` Jeffrey Carter
replies disabled

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