Thursday, November 20, 2008

x and y coordinate of the current cursor position using c progrmming


62. Can we get the x and y coordinate of the current cursor position ?
Ans : The function wherex( ) and wherey( ) returns the x-coordinate and y-coordinate of the current cursor position respectively. Both the functions return an integer value. The value returned by wherex( ) is the horizontal position of cursor and the value returned by wherey( ) is the vertical position of the cursor. Following program shows how to use the wherex( ) and wherey( ) functions.

#include 
main( )
{
printf ( "Just\n To\n Test\n Where\n the cursor\n goes" ) ;

printf ( "Current location is X: %d Y: %d\n", wherex( ), wherey( ) ) ;
}

No comments:

Blog List