comp.lang.ada
 help / color / mirror / Atom feed
From: Alfred Hilscher <Alfred.Hilscher@icn.siemens.de>
Subject: Re: Ada way to read/write to character file
Date: Mon, 07 Jan 2002 16:13:47 +0100
Date: 2002-01-07T16:13:47+01:00	[thread overview]
Message-ID: <3C39BB2B.57F2BB3D@icn.siemens.de> (raw)
In-Reply-To: m38zbdqa5r.fsf@jupiter.solar.system

Hi Michael,

I think it's because Text_IO is designed for sequential files where it
does not make sense to switch between reading and writing. For what you
want do you should use "Direct_IO" which provides an open mode
"Inout_file". 

e.g. package Com_IO is new Direct_IO (Character); -- hope this works as
intended


Michael Bode wrote:
> 
> Hi,
> 
> I'm wondering if there is an Ada way (i.e. standard package) to read
> and write to a character mode (sequential) file like the COM?:
> resp. /dev/ttyS? interface. Ada.Text_IO has no read/write file mode
> and with GNAT I wasn't able to connect two File_Type variables to the
> same physical file at the same time.
> 
> I want to communicate with a device hanging on the RS232 port. I have
> to write to the device and read the answers. I could of course do it
> like open, write, close, open read, close, open,... But I think this
> is not very elegant. I just finished doing it with the Win32
> resp. POSIX API functions, but I'm still wondering if it could be done
> with some standard Ada package.



  reply	other threads:[~2002-01-07 15:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-05 12:01 Ada way to read/write to character file Michael Bode
2002-01-07 15:13 ` Alfred Hilscher [this message]
2002-01-09  0:04   ` Nick Roberts
2002-01-09  2:12     ` tmoran
2002-01-09  6:25       ` Michael Bode
2002-01-09 16:12         ` Georg Bauhaus
2002-01-09 20:38           ` Michael Bode
2002-01-09 23:57             ` James Rogers
2002-01-10  6:17               ` Michael Bode
2002-01-10 23:13             ` Georg Bauhaus
2002-01-09 12:11       ` Nick Roberts
2002-01-09 14:17         ` Ted Dennison
2002-01-11  0:19           ` Nick Roberts
2002-01-12 16:01             ` Michael Bode
replies disabled

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