On Sat, 09 Oct 2010 14:26:31 +1100 David Bowskill <[email protected]> wrote:
> Thanks Lisa for your reply, my requirement I gather is not that > unusual. Since you enlightened me on the concepts of 'raw' or > 'cooked' terminals, I have found several other sources on this as > follows: > http://osr507doc.sco.com/en/OSUserG/_How_to_get_a_character.html > http://stackoverflow.com/questions/421860/c-c-capture-characters-from-standard-input-without-waiting-for-enter-to-be-pre. > There are others as well. I wish to be able to compile the code to > run under MSWindows (ugh!) for friends to use, so the solution must > satisfy this. Thanks again for your invaluable help. > Regards > David Bowskill Hi David, I believe there are curses/ncurses libraries for windows as well as Linux/Unix, so again that's one option. However there is also windows conio.h header, which includes a getch() and _getch() ( the latter being the reccomended one as the former is deprecated ) which do what you want (I believe, I rarely code for windows). In this case you'll need to use preprocessor directives to ensure only the code for the target OS is compiled: #ifdef _WIN32 /* do windows specific code here */ #else /* do Linux/Unix/Posix code here */ #endif -- Lisa Milne <[email protected]> -- ubuntu-au mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-au
