comp.lang.ada
 help / color / mirror / Atom feed
* Using fwrite in Ada
@ 2005-08-10 17:01 Makhno
  2005-08-10 17:28 ` Georg Bauhaus
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Makhno @ 2005-08-10 17:01 UTC (permalink / 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







^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-08-11 21:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-10 17:01 Using fwrite in Ada Makhno
2005-08-10 17:28 ` Georg Bauhaus
2005-08-10 18:05 ` Martin Krischik
2005-08-11 17:01 ` tmoran
2005-08-11 21:59   ` Jeffrey Carter

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