I'm writing a program for school; it's my first time working with C.
I'm using fgets to read input, but sometimes fgets doesn't block (throwing the program into an infinite loop). To answer everyone's first question, no, I'm not using scanf before hand leaving the extra \n which would cause this issue. I am using sscanf at one point, but that's in association with fgets so I assume that's not the issue.
There is some code that was given to us dealing with sockets. I've looked through it and can't find the source of the issue. The code isn't included due to length, but I can include it if that helps.
Long story short, is there any reason fgets wouldn't block for input apart from the scanf issue? Any help is appreciated!
EDIT: I should have made this more clear earlier, but in this case I'm using fgets solely for stdin.
fgetsreturned an error? - paddyfgets. Reread the first sentence of this comment. Make sure you process the return value offgetsonce you understand it. - Kerrek SBfgetsis returningnull, anderrnois set to 9. any ideas? - Jordan N