comp.lang.ada
 help / color / mirror / Atom feed
From: James Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: Ada way to read/write to character file
Date: Wed, 09 Jan 2002 23:57:26 GMT
Date: 2002-01-09T23:57:26+00:00	[thread overview]
Message-ID: <3C3CD8EF.7736AB1A@worldnet.att.net> (raw)
In-Reply-To: m3y9j7gsz1.fsf@jupiter.solar.system

Michael Bode wrote:
> 
> As far as I have seen all those devices use quite simple textual
> structures i.e. normal ASCII printable characters, CR, LF and maybe
> ESC. I'm not 100% sure as this is my first real Ada program, but I
> would expect no problems with this and Ada.Text_IO.
> 
> For your other points: all that may be true in general and therefore
> must be considered in a true standard package. But for my small world
> of Windows and Linux PCs Ada.Text_IO with a r/w mode would work. But
> it is not there and I wanted to make sure that I had not overlooked
> something. It was not really a big deal to write my own package and I
> had some practice in writing C bindings to OS functions too.

My experience with RS-232 serial I/O is that this has absolutely NO
relationship with file I/O. To make RS-232 I/O work you must implement
an RS-232 driver. That driver must set the appropriate bits in the
RS-232 control register on your hardware to either read or write
data. Those bit settings result in a corresponding set of bit
responses from the device, to indicate whether or not the device is
ready for the read or write. Finally, you must read or write the
byte(s), one bit at a time.

Communicating with the RS-232 driver can be abstracted to a set of
"put" and "get" procedures, but those procedures will be part of
your RS-232 driver definition, and not related to Ada.Text_IO.

Unix likes to pretend that all devices are programmatically 
equivalent to files. This is done through some conventions and
odd mappings between files and device drivers. Note that this is
operating system specific, not language specific. 

Jim Rogers
Colorado Springs, Colorado USA



  reply	other threads:[~2002-01-09 23:57 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
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 [this message]
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