For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > October 2007 > Re: Get current screen location









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Get current screen location
Stephane CHAZELAS

2007-10-24, 7:18 pm

2007-10-24, 16:23(+02), Markus Mayer:
[...]
> How would I do this programmatically? (I have to say that I'm absolutely
> new to *nix programming and shell usage)

[...]

tcgetattr(3) to fetch the previous terminal attributes.
tcsetattr(3) to clear the ICANON, ISIG and ECHO bits and set the VMIN
and VTIME and to restore the previous settings afterwards.
write(1, "\033[6n", 4); to send the escape sequence.
read(0, &c, 1); to read characters one at a time until you find
'R'
sscanf to extract the coordinates from \e[y;xR string.

But it looks like what you really want is to use ncurses that
provides with all the functions to create visual applications on
a terminal.

--
Stéphane
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com