Sistemas Operativos > GNU/Linux
Programacion Consola
(1/1)
abebex17:
Hola, a todos, mi pregunta es cual es la libreria equivalente de conio.h de borland en linux ,ya que cuan :unsure: do la incluyo no la encuentra, programando con la libreria svgalib hay una que es vga_getch(); que y otras parecidas, a las que habia en conio.h , donde encuentro todas esas rutinas, getch();,clrscr();,kbhit();.
Saludos.
NRM:
Aca tenes un "port" de conio.h que utiliza ncurses (fueron escritas por un brasilero). Espero te sirva.
--- Código: Text ---// conio.h// CONIO.H UTILIZANDO OS RECURSOS DA BIBLIOTECA NCURSES //// ---------------------------------------------------- //// //// DESENVOLVIDO POR: JEFFERSON DOS SANTOS FELIX, ABRIL 2004 //// // #ifndef __NCURSES_H#include <curses.h>#endif #define BLACK 0#define RED 1#define GREEN 2#define BROWN 3#define BLUE 4#define MAGENTA 5#define CYAN 6#define LIGHTGRAY 7#define DARKGRAY 8#define LIGHTRED 9#define LIGHTGREEN 10#define YELLOW 11#define LIGHTBLUE 12#define PINK 13#define LIGHTCYAN 14#define WHITE 15 #define DEFAULT_PAIR 57 int initconio(void);int endconio(void);int clrscr(void);int textcolor(short color);int textbackground(short color);int gotoxy(int x, int y);int wherex(void);int wherey(void); short cur_pair;int cur_bold; int initconio(void){ int f, b; short p; initscr(); start_color(); p = 1; for(f = 0; f < 8; f++) for(b = 0; b < 8; b++, p++) init_pair(p, f%8, b%8); cur_pair = DEFAULT_PAIR; cur_bold = 0; bkgd(COLOR_PAIR(cur_pair)); color_set(cur_pair, NULL); attr_off(A_BOLD, NULL); return 0;} int endconio(void){ endwin(); return 0;} int clrscr(void){ bkgd(COLOR_PAIR(cur_pair)); if(cur_bold == 1) attr_on(A_BOLD, NULL); else attr_off(A_BOLD, NULL); clear(); return 0;} int textcolor(short color){ short f, b, x, y; short p; pair_content(cur_pair, &f, &b); p = 1; for(x = 0; x < 8; x++) for(y = 0; y < 8; y++, p++) if((x == (color%8))&&(y == b)) cur_pair = p; color_set(cur_pair, NULL); if(color >= 8) { cur_bold = 1; attr_on(A_BOLD, NULL); } else { cur_bold = 0; attr_off(A_BOLD, NULL); } return 0;} int textbackground(short color){ short f, b, x, y; short p; pair_content(cur_pair, &f, &b); p = 1; for(x = 0; x < 8; x++) for(y = 0; y < 8; y++, p++) if((x == f)&&(y == (color%8))) cur_pair = p; color_set(cur_pair, NULL); return 0;} int gotoxy(int x, int y){ move(x - 1, y - 1); return 0;} int wherex(void){ int x, y; getyx(stdscr, x, y); return x + 1;} int wherey(void){ int x, y; getyx(stdscr, x, y); return y + 1;}
abebex17:
Osea que la biblioteca que yo nessito es Curses.h o NCurses.h???? y de donde puedo sacar la getch(); que es la que que mas nesesito.
Saludos. :hola:
NRM:
ncurses es una libreria que viene generalmente con la mayor parte de las distribuciones. Sino es asi en la tuya entra a el siguiente link http://www.gnu.org/software/ncurses/
Espero te sirva.
[BlueDolph]:
Hola...
Mira... en Linux no tenes conio.h... tenes como bien te dijeron curses.h o ncurses.h ... y ahí mismo vas a encontrar una funcion getch como la que usas en Win, aunque son mucho mas completas esas libs que conio.h...
Saludos...
[BlueDolph]
Navegación
Ir a la versión completa