I think I chose getch because it didn't require an enter press.
I think I chose getch because it didn't require an enter press.
that's not how getch or getchar are being used in the program? it's for real input in this case, not pausing to keep the window open.Originally Posted by laserlight
Should I use scanf instead? or fgets or something else? I have no idea.
Right, but as I noted in post #14, you do not need it at all. For more information, read How to keep a Windows console from closing.Originally Posted by matthew82
Of course, but in the case of "real input", I would still recommend changing to getchar(), at least for the time being.Originally Posted by Meldreth
EDIT:
getchar() should be correct, methinks.Should I use scanf instead? or fgets or something else? I have no idea.
Frankly, Meldreth is right: your exact usage of getch() did not register when I read your code (in my defense, it is 4 a.m. and I am awake for fun), but I still would recommend that you prefer what is standard until you have acquired more knowledge of C.
Last edited by laserlight; 02-06-2009 at 02:19 PM.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)