Date: Tue, 8 Jul 1997 16:50:26 +0300 (IDT) From: Eli Zaretskii To: Anton Helm cc: djgpp AT delorie DOT com Subject: Re: serial ports In-Reply-To: <3.0.2.16.19970708152822.28a75b54@hal.nt.tuwien.ac.at> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Tue, 8 Jul 1997, Anton Helm wrote: > I would like to open a serial port (com2) > as a file to use it as input for a flex/bison > parser. > Can I do that with djgpp ? (How ?) Devices can be treated just like files on MSDOS. So the following should work: FILE *fcom2 = fopen ("COM2", "r"); int fdcom2 = open ("COM2", O_RDONLY); You will have to use BIOS calls to set the port to the required parameters (baudrate etc.) before you open it. Also note that this simple approach will only work for low baudrates, since BIOS support for COM ports is very slow. For a more sophisticated approach, I suggest to use the DJGPP Filesystem Extensions feature.