gefa
March 21, 2006, 11:06am
1
Iam attempting a script to return the current cursor position using the getyc macro
I have #included the curses.h
however on compilation (with gcc) it errors with
Undefined symbol .getcury
Undefined symbol .gercurx
Any ideas where I can find a solution or what I've missed
there is no getyc macro and only getyx macro available
did u compile with -lcurses option?
If you still have problem.
Please post your code!!!
gefa
March 22, 2006, 3:43am
3
I have now !, many thanks for your advice.
gefa
March 23, 2006, 3:45am
4
I do have one further issue however, the line is returned 16424 and the column as 9001 no matter where the cusror is ?
The code is very basic but reads as follows;
#include <curses.h>
int rvline, rvcolumn;
main()
{
WINDOW *my_window;
getyx(my_window, rvline, rvcolumn);
printf ("The line is %i\n", rvline);
}
yes it will display some junk value,
you are still not in graphics mode and still in console mode,
initialize graphics mode and find the cursor position !!!
man initscr
and
man endwin
for details
gefa
March 24, 2006, 4:45am
6
Thanks for the info, read the man pages but not sure how and where to put the subroutine in the script
I've put it at the top, but being fairly new and a bit of a novice to C I'm not confident
#include <stdio.h>
#include <curses.h>
WINDOW *initscr(void);
SCREEN *newterm(char *type,
FILE *outfile,
FILE *infile);
initscr();
main()
{
int rvline, rvcolumn;
WINDOW *my_window;
getyx(my_window, rvline, rvcolumn);
printf ("The line is %i\n", rvline);
}
compilation errors
CursorPos.c:7: conflicting types for `initscr32'
CursorPos.c:3: previous declaration of `initscr32'
CursorPos.c:7: warning: data definition has no type or storage class
functions redeclared and conflicting with the prototypes;
and still you have not invoked the graphics mode and still in console mode.
Try the following code,
#include <stdio.h>
#include <curses.h>
int main()
{
int rvline, rvcolumn;
WINDOW *my_window;
my_window=initscr();
getyx(my_window, rvline, rvcolumn);
wprintw(my_window, "prior to cur movement %d %d\n", rvline, rvcolumn);
getyx(my_window, rvline, rvcolumn);
wprintw(my_window, "after to cur movement %d %d\n", rvline, rvcolumn);
wprintw(my_window, "CURSOR");
getyx(my_window, rvline, rvcolumn);
wprintw(my_window, "\nafter to cur movement %d %d\n", rvline, rvcolumn);
getch();
endwin();
return 0;
}
gefa
March 24, 2006, 7:29am
8
Thanks, your help is appreciated. (it now works!)