[luau] C program question

Dean Fujioka dean at poshawaii.com
Thu May 23 12:20:00 PDT 2002


What i usually use in C++ is a separate header file with

void PressEnter(istream& ins, ostream& outs)
{
outs << "Press Enter to Continue.";
getline(ins, '\n');
cin.ignore(100, '\n');
}

then call it with

PressEnter(cin,cout);

p.s this is from memory, I don't have the code i use in front of me, but I
can repost that later if you like. (if this doesn't compile)

dean




----- Original Message -----
From: "Ben Beeson" <beesond001 at hawaii.rr.com>
To: "LUAU" <luau at videl.ics.hawaii.edu>
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:
> [ben at VALinux 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
> LUAU at videl.ics.hawaii.edu
> http://videl.ics.hawaii.edu/mailman/listinfo/luau
>




More information about the LUAU mailing list