Article View: es.comp.os.linux.programacion
Article #13281Re: Programas en C con colores, locate y sin ncurses
From: juan
Date: Wed, 07 Mar 2001 19:17
Date: Wed, 07 Mar 2001 19:17
39 lines
2100 bytes
2100 bytes
jperro escribi�:
> Hay alguna alternativa m�s sencilla que ncurses (o al menos mejor
> documentada) para hacer una aplicaci�n al estilo de las de texto MS-DOS con
> colores, posici�n del cursor, etc
Hola te aconsejo que mires el siguiente programa :
/* This file was generated by QuasiBASIC to C translator */
/* qb2c ver.3.40 Free Version 17.Nov 1999 */
translada codigo basic a C y si te fijas como lo hace aprenderas a programar
la consola.
Yo tengo hecho algunos programas , est�n en http://www.geocities.com/SETA43
Como hacer un locate x,y
printf("\033[%d;%d;f",(int)(4),(int)(38));
printf("%s\n","DOMINIO PUBLICO");
Como hacer un color tinta,papel
extern int COLOR(int fg, int bg)
{
int col, att;
char a_S[32];
if (bg>=0) { printf("\033[0;%dm",40+(bg % 8));}
else { printf("\033[0m");}
fg = fg % 32;
if (fg <= 7) { printf("\033[%dm",30+fg); }
if ( 7 < fg && fg <= 15) { printf("\033[1;%dm",22+fg); }
if (15 < fg && fg <= 23) { printf("\033[5;%dm",14+fg); }
if (23 < fg) { printf("\033[1;5;%dm",6+fg); }
}
Suerte.
Hasta pronto
JUAN
Technical Details
Message-ID:
<3AA68960.4A0F7B38@santandersupernet.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!bignews.mediaways.net!news-fra1.dfn.de!news.tele.dk!204.71.34.15!news-out.cwix.com!newsfeed.cwix.com!newsfeed.bcn.ttd.net!news.bcn.ttd.net!not-for-mailReferences:
<982m17$2rc$1@mercurio.cica.es>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII X-Google-Thread: f86c8,dd5e4e9d15bc5b8d X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2001-03-07 14:43:22 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!bignews.mediaways.net!news-fra1.dfn.de!news.tele.dk!204.71.34.15!news-out.cwix.com!newsfeed.cwix.com!newsfeed.bcn.ttd.net!news.bcn.ttd.net!not-for-mail From: juan <SETASETA@santandersupernet.com> Newsgroups: es.comp.os.linux.programacion Subject: Re: Programas en C con colores, locate y sin ncurses Date: Wed, 07 Mar 2001 20:17:52 +0100 Organization: Grupo de Empresas Antakira Lines: 40 Message-ID: <3AA68960.4A0F7B38@santandersupernet.com> References: <982m17$2rc$1@mercurio.cica.es> NNTP-Posting-Host: 193-153-225-34.uc.nombres.ttd.es Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mozilla 4.72 [es] (X11; U; Linux 2.2.14-5.0 i586) X-Accept-Language: en To: noseveia@uma.es