🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1674

Help! serial comm problems

#1674
From: Gord Kurtenbach
Date: Thu, 26 Jul 1990 01:57
32 lines
1480 bytes
I'm not a DOS programmer and I`m trying to write a program to read and 
write over the serial port. The basic structure is:

while (1) {

	<if there is something to send out then stuff it down the serial port >

	<if something has been sent to the serial port then read it>
}


I've tried opening "com2" using fopen and I can successsfully stuff
data down the stream. But when I try to read from the stream with say
a call to fgetc, I get a "General failure reading com2:" errormessage.
I've fopened com2 for reading and writing and the baud rates etc are
correct and I can read data from the hardware port using bioscom so
communication is working.  What is wrong here? Will this approach work
or am I on the wrong track?

My second question is, if I do get the read working how can I avoid 
blocking on it?

If some kind soul out there has a stitch of code (C would be great)
that does what I want I would be most thankful for their help.

Thanks.

Gord Kurtenbach

PS: I've notice that the DOS command "copy com2: junk" also gives the
same error. Could my system be configured wrong?
Technical Details
Message-ID: <487@roo.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!ames!bionet!arisia!roo!kurtenba

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!ames!bionet!arisia!roo!kurtenba
From: kurtenba@parc.xerox.com (Gord Kurtenbach)
Newsgroups: comp.os.msdos.programmer
Subject: Help! serial comm problems
Keywords: serial communication port RS232
Message-ID: <487@roo.UUCP>
Date: 26 Jul 90 01:57:46 GMT
Sender: news@parc.xerox.com
Lines: 32