From owner-freebsd-questions Thu Jun 13 11:19:24 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id LAA09334 for questions-outgoing; Thu, 13 Jun 1996 11:19:24 -0700 (PDT) Received: from who.cdrom.com (who.cdrom.com [204.216.27.3]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id LAA09316 for ; Thu, 13 Jun 1996 11:19:13 -0700 (PDT) Received: from relay-2.mail.demon.net (disperse.demon.co.uk [158.152.1.77]) by who.cdrom.com (8.6.12/8.6.11) with SMTP id LAA03688 for ; Thu, 13 Jun 1996 11:19:05 -0700 Received: from post.demon.co.uk ([158.152.1.72]) by relay-2.mail.demon.net id ao28680; 13 Jun 96 19:13 +0100 Received: from jraynard.demon.co.uk ([158.152.42.77]) by relay-3.mail.demon.net id aa03863; 13 Jun 96 18:21 +0100 Received: (from fqueries@localhost) by jraynard.demon.co.uk (8.7.5/8.6.12) id LAA25881; Thu, 13 Jun 1996 11:59:08 GMT Date: Thu, 13 Jun 1996 11:59:08 GMT Message-Id: <199606131159.LAA25881@jraynard.demon.co.uk> From: James Raynard To: jstuardo@lucas.elo.utfsm.cl CC: questions@freebsd.org In-reply-to: <31BF5A81.7DAB@lucas.elo.utfsm.cl> (message from Jaime Stuardo on Wed, 12 Jun 1996 21:02:09 -0300) Subject: Re: UNIX question Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > Let me make a question about UNIX. How can I initialize serial ports > COM1, COM2 in UNIX by mean of a C program? after initialized, how can I > send data to them? Do you know where can I get an example program about > that? In Unix, everything is a file, so you can just use functions like open(), read() and write() to communicate with a modem, for example (and perhaps a call to tcsetattr() to configure it). Any good book or resource related to Unix programming should have examples of how to use these functions. If you need to communicate directly with hardware, use inb() and outb() after opening /dev/io - see /usr/include/machine/cpufunc.h. -- James Raynard, Edinburgh, Scotland james@jraynard.demon.co.uk jraynard@FreeBSD.ORG