I am writing a charachter based game in C for Linux (using gcc)
and I use getchar() to wait on the keyboard for a charactor. But It wont return untill I hit 'cr', This seems to be cooked behaviour, Is there a way to turn on raw behavour?
Thanks
I am writing a charachter based game in C for Linux (using gcc)
and I use getchar() to wait on the keyboard for a charactor. But It wont return untill I hit 'cr', This seems to be cooked behaviour, Is there a way to turn on raw behavour?
Thanks
To wait on, and accept any character from the keyboard it's getch - not - getchar. getchar works, but getch works immediately and only accepts 1 character the moves on.
The world is waiting. I must leave you now.
1. Read this
http://www2.linuxjournal.com/cgi-bin...termios§=1
2. turn off the ICANON bit
I think....
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.