From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c64c5909c07a2300 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-08 16:42:11 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!ppp-1-156.cvx4.telinco.NET!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: Ada way to read/write to character file Date: Wed, 9 Jan 2002 00:04:20 -0000 Message-ID: References: <3C39BB2B.57F2BB3D@icn.siemens.de> NNTP-Posting-Host: ppp-1-156.cvx4.telinco.net (212.1.148.156) X-Trace: fu-berlin.de 1010536927 27343413 212.1.148.156 (16 [25716]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Xref: archiver1.google.com comp.lang.ada:18673 Date: 2002-01-09T00:04:20+00:00 List-Id: "Alfred Hilscher" wrote in message news:3C39BB2B.57F2BB3D@icn.siemens.de... > 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 No, no, no! This won't vaguely work. Michael wants to use a serial device for (bidirectional) sequential text I/O. Ada.Direct_IO is for random binary file access (totally different!). > 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. I think the answer to this question is, unfortunately, "No". Personally, if I were writing an Ada.Text_IO implementation for MS-DOS (or Windows) or an *n[iu]x, I would have made damn sure it could be used (bidirectionally) with the character devices, but there's nothing (and there could not sensibly have been anything) in the RM95 compelling any implementation to do so. -- Best wishes, Nick Roberts