Xref: utzoo unix-pc.general:2203 comp.sys.att:5483 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!lll-lcc!pyramid!cbmvax!ditto From: ditto@cbmvax.UUCP (Michael "Ford" Ditto) Newsgroups: unix-pc.general,comp.sys.att Subject: Re: termio(7) and read(2) problem! Summary: fcntl() Keywords: NDELAY Message-ID: <5929@cbmvax.UUCP> Date: 9 Feb 89 03:33:34 GMT References: <137@zebra.UUCP> <7411@chinet.chi.il.us> <10652@stb.UUCP> Reply-To: ditto@cbmvax.UUCP (Michael "Ford" Ditto) Organization: Commodore Technology, West Chester, PA Lines: 23 In article <10652@stb.UUCP> michael@stb.UUCP (Michael) writes: >Does anyone know how to turn ON NDELAY for an already open file? Use fcntl(2): int oldmode = fcntl(fd, F_GETFL); if (oldmode == -1) perror("fcntl(F_GETFL)"); else if (fcntl(fd, F_SETFL, oldmode|O_NDELAY) == -1) perror("fcntl(F_SETFL)"); Or, if you're not a fan of error checking: fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)|O_NDELAY); -- -=] Ford [=- "The number of Unix installations (In Real Life: Mike Ditto) has grown to 10, with more expected." ford@kenobi.cts.com - The Unix Programmer's Manual, ...!sdcsvax!crash!elgar!ford 2nd Edition, June, 1972. ditto@cbmvax.commodore.com