How do I prevent holding when reading stdin?
I'm creating a program with glut that uses the terminal for input and using fscanf() is holding up the process. How can I check the stream before calling fscanf()?
How do I prevent holding when reading stdin?
I'm creating a program with glut that uses the terminal for input and using fscanf() is holding up the process. How can I check the stream before calling fscanf()?
You could try googling non-blocking I/O.
Using select is a viable approach on some systems. There are other input query mechanisms on other platforms. What system are you operating in?
Found a solution:
http://stackoverflow.com/questions/717572/c-nonblocking-io-on-linux
Earlier I was googling non-holding rather than non-blocking, which didn't give me that helpful of a result.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.