[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] Färger på printf-output...



Johan Andersson skrev:

> Jag bara undrar om någon vet hur man gör färger på vanliga
> printf-outputten??
> I Dos fanns conio.h, men den verkar inte finnas i freebsd
> och linux.

Husk at unix supporterer i hundredevis af forskellige
terminaltyper. Derfor skal man først checke TERM i
environment.

man 3 getenv

Nu kendes terminaltypen, og man kan bruge tgetent() for at
finde escape sekvensen for den farve man vil have.

man 5 terminfo

Se også
man 1 infocmp
man 1 tic

Prøv også infocmp -L

Hvis du vil se eksempler, så kig i sourcekoden til
programmer der kan sætte skærmfarver, f.eks. setterm
eller tput.

Prøv f.eks. kommandoen
tput setb 4
for at se om terminalen kan lave farve.
Og
tput sgr0
for at få den væk igen.

-- 
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] *