termio(7) and read(2) problem!

Lenny Tropiano lenny at icus.islp.ny.us
Sat Feb 11 01:13:40 AEST 1989


In article <599 at icus.islp.ny.us> lenny at icus.islp.ny.us (Lenny Tropiano) writes:
|>
|>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...
|>
I guess next time I should look in the manual first.  It's been a while 
since I did fcntl, and the "DIAGNOSTICS" section of the manual page fcntl(2)
says that the return value of F_GETFL is the file flags.  Therefore there is
*no* argument ...  Thanks Mike, you enlightened me again :-)  

	oflags = fcntl(fd, F_GETFL);
	if (oflags != -1)
		fcntl(fd, F_SETFL, oflags | O_NDELAY);	

-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