Date: Thu, 17 Oct 2002 07:55:42 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Hyeong-Tae Jou cc: djgpp AT delorie DOT com Subject: Re: Serial port (RS232C) open In-Reply-To: <3DAE1468.4070207@kordi.re.kr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 17 Oct 2002, Hyeong-Tae Jou wrote: > In Linux, I used C-functions like > open(), tcsetattr(), and read() > for opening, setting parameter, and reading data from > serial port. > > I am trying to use the same C-code in Win2000. Sorry, this won't work. The DJGPP emulation of termios functions works only for terminals, it doesn't support COM1 serial port. This is actually documented in the library docs of termios functions, which see. > How can I read the actual bytes in serial port buffer ? > Is there any functions to check the bytes in buffer of serial port. > "ioctl(fd, FIONREAD, &nbyte)" doesn't work in DOS (Win2000). You will need to use the DJGPP Filesystem Extension machinery to extend ioctl and termios to support COM1. There are libraries out there that support fast interrupt-driven serial I/O (one of them was mentioned in this thread; see the DJGPP FAQ section 22.4 for more pointers), but you will have to add wrappers to those libraries to use file I/O and termios with them.