Forum Discussion
Altera_Forum
Honored Contributor
21 years agobreak loop with 'q'
Hello, this may be a very beginner question, but I cannot get ahead. I have a loop wich should be performed until the user presses 'q'. I tried with getchar() but it seems that getcha...
Altera_Forum
Honored Contributor
21 years agoThis happens because the default STDIN is blocking; it waits for an input before returning a value. To make the system do what you want you must make it a non-blocking call. If you are using the 5.0 release of Nios II you can use the fcntl call and change STDIN to non blocking (O_NONBLOCK flag). If you are using an earlier release, you can change the flags directly or create a new file handle for the serial line and create to be non-blocking.
Hope this helps. Michael