Friday Aug 18, 2006

It's a long long time since I did anything meaningful in C. So I decided to refresh my knowledge and straightaway landed in spot.

#include
main()
{
system("clear");
getch();
}

Problem #1: gcc test.c compiles only if the -lcurses option is provided. :-/ . Wondering what the pre-processor is doing.

Problem #2: even when compiled with -lcurses option, the program dumps core due to segmentation fault in wgetch()

mdb core
Loading modules: [ libc.so.1 ld.so.1 ]
> ::stack
libcurses.so.1`wgetch+0x24(0, 0, 1dc74, 0, ff38a000, ff392378)
main+0x20(1, ffbff3ec, ffbff3f4, 209bc, ff3a00c0, ff3a0100)
_start+0x5c(0, 0, 0, 0, 0, 0)
> $q

Appreciate enlightment on the issue.

This blog copyright 2009 by maddy