delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/10/17/01:55:52

Date: Thu, 17 Oct 2002 07:55:42 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Hyeong-Tae Jou <htjou AT kordi DOT re DOT kr>
cc: djgpp AT delorie DOT com
Subject: Re: Serial port (RS232C) open
In-Reply-To: <3DAE1468.4070207@kordi.re.kr>
Message-ID: <Pine.SUN.3.91.1021017075129.3848D-100000@is>
MIME-Version: 1.0
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

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019