Author Topic: [ C ] Need some help with libncurses  (Read 4599 times)

0 Members and 1 Guest are viewing this topic.

Offline 0poitr

  • Peasant
  • *
  • Posts: 149
  • Cookies: 64
    • View Profile
[ C ] Need some help with libncurses
« on: January 09, 2013, 06:37:53 pm »
EDIT : My bad. Its getsyx() and setsyx() not xy.

Hello. I actually want to update three different lines in console simultaneously (well, psudo), i.e. in a loop they will be constantly updated and they are three separate lines. Now of course the line are separated by \n s but I don't want to keep printing print new lines all the way throughout the loop. Just the three lines should be updated as the loop proceeds. Hope you get me :)
Now, I have left my hope with the std C library. I have been trying to manipulate the terminal with the ncurses library. As far as I've known yet I can do it like
Code: [Select]
getsxy(); /* get current cursor pos */
print 3 lines;
setsxy(); /* set curr cursor pos (only modifies the data structure)*/
wclrtobot(); /* clr from cursor to end of screen */
doupdate(); /* display the updated buffer */
Now, problem is, somehow, the linker throws undefined reference errors for getsxy and setsxy although not for the other functions from the library ( am compiling with gcc -lncurses )

Can someone help me out? This is first time am dealing with the curses library.
btw, here's the program am working on :: https://evilzone.org/c-c/(c)-matrix-effect-printing-text/msg44011/#msg44011
« Last Edit: January 09, 2013, 07:53:40 pm by 0poitr »
Imagination is the first step towards Creation.

Offline Xires

  • Noob Eater
  • Administrator
  • Knight
  • *
  • Posts: 379
  • Cookies: 149
    • View Profile
    • Feed The Trolls - Xires
Re: [ C ] Need some help with libncurses
« Reply #1 on: January 15, 2013, 05:25:09 am »
Try ANSI escape sequences.

http://wiki.bash-hackers.org/scripting/terminalcodes

Code: (bash) [Select]
echo -e "\033[y;xH"


Code: (c) [Select]
printf("\033[%d;%dH", y, x);
« Last Edit: January 15, 2013, 05:28:21 am by Xires »
-Xires

Offline 0poitr

  • Peasant
  • *
  • Posts: 149
  • Cookies: 64
    • View Profile
Re: [ C ] Need some help with libncurses
« Reply #2 on: January 15, 2013, 12:32:21 pm »
Quote
Try ANSI escape sequences.
yeah, that's what I did.
Imagination is the first step towards Creation.