LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how to make nonblocking FILE *fp? (https://www.linuxquestions.org/questions/programming-9/how-to-make-nonblocking-file-%2Afp-363225/)

Thinking 09-14-2005 05:01 AM

how to make nonblocking FILE *fp?
 
hiho@ll

i create a socket connection and use fdopen so i can use fgets fputs .... functions

the problem
if do fcntl(); on the socket to make it O_NONBLOCK and then make fopen
fgets it blocks!

is it impossible to do nonblocking operations with fgets? or did i something wrong with my code to set it nonblocking:

fcntl(sv[1],F_SETFL,fcntl(sv[1],F_GETFL)|O_NONBLOCK|O_NDELAY);

or is there a function other than fcntl i have to use to set the FILE *fp to nonblocking?

thx@ll

Thinking 09-14-2005 05:07 AM

damn

forget the post
i used the wrong descriptor!

NONBLOCKING works for fgets ... functions


All times are GMT -5. The time now is 03:44 AM.