Hi Gurus,
Thanks a lot to Mike DeMarco who helped me to solve the problem. He gave a
sample program which solved my query..
The syntax for getch is int getch(void). Also we need to call initscr() that
does a curses initialization and at the end, you need to call endwin so that
the terminal will be usable.
I also got replies from Hendrik Visage,Corinne Lenta. Thanks a lot to all
who has helped me to solve the query.
I am enclosing the code which mike has given.
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <curses.h>
main()
{
int x;
initscr();
x=getch();
printf( "You typed %d\n", x );
endwin();
}
gcc -o junk junk.c -lcurses -ltermlib -lm -lc
My Original Query was:
> Hi Gurus,
>
> Sorry for the C program posting. I have installed gcc and i am trying to
> call a function from curses.h.
> But compilation stops with abnormal errors.
> eg:
>
> #include <curses.h>
> main()
> {
> char ch;
> ch=getch();
> }
>
> When i compile the above code i get the following error,
> (my program name is junk.c)
> # cc junk.c
> Undefined first referenced
> symbol in file
> wgetch /var/tmp/ccXgaqEI1.o
> stdscr /var/tmp/ccXgaqEI1.o
> ld: fatal: Symbol referencing errors. No output written to a.out
>
> However when i compile using
> cc junk.c -lcurses it compiles and when i run a.out it gives segmentation
> fault core dump.
>
> Can some one point me.
> Thanks will summarise
> Regards
> Sriram
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:25 CDT