I'm having trouble getting my program to accept hitting the enter key to continue... I tried getchar() two ways (as condition for while loop and just calling the routine) but one doesn't pause the program and await input it just goes through it all and the other pauses but wont let me enter anything or continue when i hit enter...
void RestOfGame(int r, int c, int mG, int **cGen,int **nGen) {
int i = 0, q = 0;
for (i = 2; i <= mG; i++) {
printf("\n(press enter to continue)\n\n");
getchar();
printf("Generation %d:\n", i);
ExamineReplace(r, c, cGen, nGen);
NewToOld(r, c, cGen, nGen);
DrawGrid(r, c, cGen);
}
}
I read in a few other threads something about having previously scanned in something and the buffer keeping the \n... tried some variations but I dont think i did it right.
Working on a windows platform, C language. Any suggestions?
UPDATE: Thought I might add that this code is being run with a data file as input in redirection at command line. Would confuse my getchar() even though I've read through the entire file?