comp.lang.ada
 help / color / mirror / Atom feed
From: Konstantin Gromov <gkg@leland.stanford.edu>
Cc: gkg@leland.stanford.edu
Subject: Beginners Ada Question on Ada IO.
Date: 1996/12/11
Date: 1996-12-11T00:00:00+00:00	[thread overview]
Message-ID: <32AE796C.36DDA3C0@leland.stanford.edu> (raw)


Hello everyone,

	I just started learning Ada, and I like it better than C or C++.
But one thing drive me nuts... All text books and tutorials talk 
only about character IO, and in what I am doing I need binary IO.
I am trying to generate some data and then output it to the file byte
by byte. (Later I'll have to read binary data from one file (really
device)
and send it to another.) All this happens under Unix. 

	Here example of what I am trying to do:

  ....
type EEPROM is array(0 .. 16383 , 0 .. 6) of Integer range 0 .. 255;
  ....
Data              : EEPROM;
ROM_File          : Ada.Text_IO.File_Type;
  ....
  -- Here I am stuffing array "Data" with some numbers
  .... 
Ada.Text_IO.Create(ROM_File, Ada.Text_IO.Out_File, "rom.dat");
for A in 0 .. 16383
loop
   -- Next line is a line wich causes me problems.
   -- Basicly I am trying to do C thing: "putc(Data(A,6), ROM_File);"
   -- but it is wrong, and I cannot find an answer...
   Ada.Text_IO.Put ( Item => (Character)Data(A,6), File => ROM_File );  
   Ada.Text_IO.New_Line(File => ROM_File);
end loop;
Ada.Text_IO.Close(ROM_File);


I'll appreciate any help or hints on where I can find a detailed 
information on the subject.

Please answer via email.

Thank you in advance for your help.

Konstantin Gromov
gkg@leland.stanford.edu




             reply	other threads:[~1996-12-11  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-11  0:00 Konstantin Gromov [this message]
1996-12-11  0:00 ` Beginners Ada Question on Ada IO Stephen Leake
1996-12-11  0:00   ` Larry Kilgallen
  -- strict thread matches above, loose matches on Subject: below --
1996-12-12  0:00 tmoran
replies disabled

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