Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Feb 1999 12:49:29 +1030
From:      Greg Lehey <grog@lemis.com>
To:        Mark Turpin <mturpin@spel.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: Serial programming
Message-ID:  <19990202124929.H76680@freebie.lemis.com>
In-Reply-To: <36B654AC.8489301D@spel.com>; from Mark Turpin on Mon, Feb 01, 1999 at 08:28:12PM -0500
References:  <36B654AC.8489301D@spel.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday,  1 February 1999 at 20:28:12 -0500, Mark Turpin wrote:
> Hello,
>
>         Ok,  I feel really stupid having to ask this..
>
>     I'm working on a program to communicate with an  Amada  Punch
> Press.   It communicates serial.   I looked through the lists and found
> a reference to the Serial Programming Guide for POSIX compliant
> Operating Systems.   So using the information I gathered there I've
> opened the serial port like this
>
>     fd = open("/dev/ttyd0",  O_RDWR |  O_NOCTTY | O_NDELAY);
>
> Then when I go to write to the port
>
>     n = write(fd, "Hello This is a test", 20);
>
> n ends up being -1.   I'm running this as root, I've tried with minicom
> and it works fine.
>
> Any suggestions?

Look at errno and fd.

Greg
--
When replying to this message, please copy the original recipients.
For more information, see http://www.lemis.com/questions.html
See complete headers for address, home page and phone numbers
finger grog@lemis.com for PGP public key

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990202124929.H76680>