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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,608acc25a4bf84cc,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-05 14:46:04 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!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail From: Michael Bode Newsgroups: comp.lang.ada Subject: Beginners question: serial IO Date: 05 Nov 2001 23:43:25 +0100 Organization: Organized? Me? Sender: mb@jupiter.solar.system Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.t-online.com 1005000257 06 30380 NscXTsaXSAAH8k 011105 22:44:17 X-Complaints-To: abuse@t-online.com X-Sender: 320025674319-0001@t-dialin.net Xref: archiver1.google.com comp.lang.ada:15874 Date: 2001-11-05T23:43:25+01:00 List-Id: Hi, I'm just starting with Ada and have the following problem: I tried some file IO to/from the serial port aka /dev/ttyS? aka COMx:. I figured that the following code works with GNAT/Linux (and GNAT/Windows with the obvious change), but there must be a better way of doing it: with Text_IO; use Text_IO; procedure IO_Test is Com_Port : Text_IO.File_Type; Answer : Character; begin Create(Com_Port, Mode=>Text_IO.Out_File, Name=>"/dev/ttyS0"); Put(Com_Port,"Hello World!"); Close(Com_Port); Create(Com_Port, Mode=>Text_IO.In_File, Name=>"/dev/ttyS0"); Get(Com_Port,Answer); Close(Com_Port); end IO_Test; Imagine some kind of program that talks to a device on the com port constantly opening, closing and reopening /dev/ttyS0. It seems to be impossible to assign two files of type In_File and Out_File to the same device file. So, how do I do it then?