stdin doesn't work after I read from redirection -


basically, program able read input redirection until end of file. however, when i'm trying read 1 more time stdin, program reads end of file character , skips next part of program. i've been trying figure out how reset or clean stdin, nothing seems work. appreciate input (haha, that's pun) on question. thanks!

edit 1:

code:

              while( fgets(buf,sizeof(buf),stdin)  ){             printf("%s", buf);             if(strcmp(buf,"\n") == 0){               break;             }             while(write(right_con, buf,sizeof(buf)) < 0) {               printf("error writing socket\n");               exit(1);             }             memset(buf,0,sizeof(buf));           }           rc = read(keyboard,buf,sizeof(buf)); 

yeah, code has while loop first tries read redirection , sends socket. (that part works fine) biggest problem after if finished read file using loop redirection, skips read(keyboard, buf,sizeof(buf)). again. let me know if enough details.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -