You know, I never really figured out how to do a "press any key" function in C or C++, so I always just said "Press enter" by using a scanf or getchar function. I'm no expert. But if anyone has any ideas, I'd like to hear them too. Also, why the fprintf to the stdout instead of just a regular printf?
-Eric Hattemer ----- Original Message ----- From: "Ben Beeson" <[EMAIL PROTECTED]> To: "LUAU" <[EMAIL PROTECTED]> Sent: Wednesday, May 22, 2002 11:33 PM Subject: [luau] C program question > Aloha, > > I'm wrestling with a little program.... What I want is for the program to > "pause" for a moment when it is done with output until the user presses a > key. Then it should continue. What I thought should work is this: > > > #include <curses.h> > #include <stdio.h> > #include <stdlib.h> /* for exit function */ > #include <string.h> > #include <assert.h> > #include <ctype.h> > - > - > fprintf(stdout,"Press any key to proceed.\n"); > getch(); > - > - > - > > When I "make" this it returns errors like this: > [EMAIL PROTECTED] nitroxblender]$ make > gcc -Wall -g -c MOD.c > gcc -Wall -g -o MOD MOD.o > MOD.o: In function `best_mix': > /home/ben/devel/nitroxblender/MOD.c:365: undefined reference to `stdscr' > /home/ben/devel/nitroxblender/MOD.c:365: undefined reference to `wgetch' > collect2: ld returned 1 exit status > make: *** [MOD] Error 1 > > So my question is why do I get undefined references to `stdscr' and `wgetch' > when the compiler gets to the line with the call to getch()??? > > This should be easy, but for the life of me it escapes me. Any ideas would > be greatly appreciated. > > Thanks, > > Ben > _______________________________________________ > LUAU mailing list > [EMAIL PROTECTED] > http://videl.ics.hawaii.edu/mailman/listinfo/luau > >
