delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/10/16/21:45:09

From: Hyeong-Tae Jou <htjou AT kordi DOT re DOT kr>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Serial port (RS232C) open
Date: Thu, 17 Oct 2002 10:37:44 +0900
Organization: Korea Research Environment Open Network
Lines: 43
Message-ID: <3DAE1468.4070207@kordi.re.kr>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1021016083016 DOT 20518G-100000 AT is>
NNTP-Posting-Host: 210.98.53.72
Mime-Version: 1.0
X-Trace: news.kreonet.re.kr 1034818743 10406 210.98.53.72 (17 Oct 2002 01:39:03 GMT)
X-Complaints-To: usenet AT news DOT kreonet DOT re DOT kr
NNTP-Posting-Date: Thu, 17 Oct 2002 01:39:03 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; CDonDemand) Gecko/20010726 Netscape6/6.1
X-Accept-Language: ko, en-us
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Thanks,

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.
Here is the suumary of run result in Win2000:

1) open COM1 - looks OK.

2) tcsetattr - looks it works.

3) read() - This doesn't work like Linux.

   In Linux,
       n=read(fd, buf, RL) waits some bytes to read, and
        return the bytes actually read.

   In Win2000 command promt using DJGPP,
       n=read(fd, buf, RL) immediately return RL
        after reading RL byte data of almost null.

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).

jou

Eli Zaretskii wrote:

> On Wed, 16 Oct 2002, jou wrote:
>
>
>>I want to read data from serial port (RS232C).
>>Not possible to open /dev/ttyS0 in DOS.
>>
>
> Open /dev/aux or COM1 (or COM2, as the case might be) instead.
>


- Raw text -


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