termio(7) and read(2) problem!

Lenny Tropiano lenny at icus.islp.ny.us
Fri Feb 10 14:50:14 AEST 1989


In article <10652 at stb.UUCP> michael at stb.UUCP (Michael) writes:
|>In article <7411 at chinet.chi.il.us> les at chinet.chi.il.us (Leslie Mikesell) writes:
|>>In article <137 at zebra.UUCP> vern at zebra.UUCP (Vernon C. Hoxie) writes:
|>>>
|>>>	I have been trying to write a test program for a Trailblazer.
|>>>It is connected to /dev/tty000.  The program opens this file with:
|>>>
|>>>	fd = open("/dev/tty000", O_RDWR | O_NDELAY);
|>>
|>>You probably need to use fcntl() to turn off the O_NDELAY before
...
|>
|>Does anyone know how to turn ON NDELAY for an already open file?
|>			Michael
...

Use the fcntl(2) system call.

#include <fcntl.h>

int	oflags;

	/* assume a file descriptor (fd) is already open and in use */
	...
	fcntl(fd, F_GETFL, &oflags);	/* get the current open flags */
				/* set the flags to have O_NDELAY too */
	fcntl(fd, F_SETFL, oflags | O_NDELAY);	

I assume that would do it for ya...

-Lenny
-- 
Lenny Tropiano             ICUS Software Systems         [w] +1 (516) 582-5525
lenny at icus.islp.ny.us      Telex; 154232428 ICUS         [h] +1 (516) 968-8576
{talcott,decuac,boulder,hombre,pacbell,sbcs}!icus!lenny  attmail!icus!lenny
        ICUS Software Systems -- PO Box 1; Islip Terrace, NY  11752



More information about the Unix-pc.general mailing list