[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] cursor pos



Kim Schultz skrev:

>> >> Er der en (smart) måde at at placere tekst på position (x,y) på skærmen, i 
C
>> >> standardbiblioteket? Eller bare som i basic, print tab(y) "blah"?
>> >
>> >> Jeg har ikke rigtigt mod på ncurses, med mindre det er strengt nødvendigt.

>Hvis jeg så ville lave et lille ur der skrev ud til samme sted hele
>tiden hvordan kunne jeg så det?? (source eksempel plz)

Da jeg ikke er en ørn til C, kan jeg ikke lige ryste noget ud af
ærmet. Men se i sourcekoden til term (ncurses pakken) eller
setterm (util-linux) hvordan de henter skærmstyrestrengene
fra terminfo databasen.

For at se noget virke, prøv følgende simple shell script,
hvor tput bruges til at printe styretegnene som den finder
i terminfo. Det kan godt være man skal trykke ctrl-c flere
gange for at få det stoppet. Jeg ved ikke hvorfor.

Advarsel: Det er en cpu høg!:

#!/bin/sh

# tænd cursoren hvis programmet bliver afbrudt:
trap "tput cnorm" 2 3 15

tput clear              # slet skærm

while true
do
        tput civis              # sluk cursor
        tput cup 11 30          # positioner cursor
        date '+%H:%M:%S'        # vis tiden
done

trap 2 3 15		# not reached

-- 
torben fjerdingstad        | linux-2.2.10-smp/GNU/gnome-1.0
sslug@sslug        |   Man skal ikke skyde bjørnen
http://www.fjerdingstad.dk |     før skindet er solgt.


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:07 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *