Serial Port (off topic)

Giorgos Keramidas keramida at ceid.upatras.gr
Fri Mar 2 00:29:01 EET 2001


On Wed, Feb 28, 2001 at 10:31:57PM +0200, Mihalis Tsoukalos wrote:
> Sugnwmy gia to off topic:
> 
> An kapoio* gnwrizei gia diabasma kai graqimo se seiriaky hura katw apo UNIX
> ha parakalousa na mou steilei ena proswpiko email.

san kanoniko arxeio anoigeis/kleineis/diabazeis/grafeis to katallhlo device:

	#define BUFLEN 512			/* ena 'tuxaio' buffer size */
	#define SERIAL_PORT "/dev/ttyS1"	/* device file for serial port */

	char buf[BUFLEN];

	if ((fd = open(SERIAL_PORT, O_RDWR, S_IREAD | S_IWRITE)) < 0)
		open_failed();

	if ((nbytes = read(fd, buf, BUFLEN)) < BUFLEN)
		read_failed();

	if ((bytes = write(fd, buf, BUFLEN)) < BUFLEN)
		write_failed();

	close(fd);

elpizo na boh8hsa :)

- giorgos



More information about the Linux-greek-users mailing list