Board index » delphi » clrscr, gotoxy,textcolor for unix.

clrscr, gotoxy,textcolor for unix.

I made this program for school.
The Development platform was Windows 2k with borland c/c++ 5.02
now I have to port it to Unix GCC compiler...

I ran into a few problems like
clrscr() and gotoxy() I solved these with these 2 functions

----code----
void GotoXY(int x, int y)
{
  printf("\033[%d;%df",x,y);

Quote
}

void clrscr(void)
{
  char a[80];
  printf("\033[2J");
  printf("\033[0;0f");
Quote
}

----/code----
the only thing is that I also use
textattr is there also a way to do that very simplisticaly ?!?
thanks in advance !!!
 

Re:clrscr, gotoxy,textcolor for unix.


Look at the ncurses library.  man ncurses on your linux machine.

Daniel van den Oord wrote:

Quote
> I made this program for school.
> The Development platform was Windows 2k with borland c/c++ 5.02
> now I have to port it to Unix GCC compiler...

> I ran into a few problems like
> clrscr() and gotoxy() I solved these with these 2 functions

> ----code----
> void GotoXY(int x, int y)
> {
>   printf("\033[%d;%df",x,y);
> }

> void clrscr(void)
> {
>   char a[80];
>   printf("\033[2J");
>   printf("\033[0;0f");
> }
> ----/code----
> the only thing is that I also use
> textattr is there also a way to do that very simplisticaly ?!?
> thanks in advance !!!

Re:clrscr, gotoxy,textcolor for unix.


On Tue, 4 Jun 2002 16:50:55 +0200, "Daniel van den Oord" <daniel...@planet.nl>
wrote:

Quote
>I have to port it to Unix GCC compiler...

Console screen control is usually done by using "CURSES"
under Unix. Check with your school re its availability.

Quote
>  printf("\033[%d;%df",x,y);
>  printf("\033[2J");
>  printf("\033[0;0f");
>I also use textattr is there also a way to do that very simplisticaly ?

Since you're already familiar with the ANSI control codes above,
have you tried adapting the rest of them for text color, etc.?

e.g. -

/* These work on mono or color monitors. */
printf("\x1B[0mThis is normal text.\n");
printf("\x1B[1mThis is bold text.\n");
printf("\x1B[0;5mThis is normal blinking text.\n");
printf("\x1B[1;5mThis is bold blinking text.\n");
printf("\x1B[7mThis is reverse bold blinking text.\n");
printf("\x1B[0m");   /* This turns all attributes off. */
printf("\x1B[K");    /* This erases the line. */
printf("\x1B[0;7mThis is reverse text.\n");
printf("\x1B[0m");   /* This turns all attributes off. */
printf("\x1B[K");    /* This erases the line. */
printf("This should now be normal text.\n");

/* These will work on color monitors only. */
printf("\x1B[0mThis is normal text.\n");
printf("\x1B[33mThis is yellow text.\n");
printf("\x1B[1;33mThis is bright yellow text.\n");
printf("\x1B[1;31mThis is bright red text.\n");
printf("\x1B[1;37;44mThis is bright white text on bright blue.\n");
printf("\x1B[0m");   /* This turns all attributes off. */
printf("\x1B[K");    /* This erases the line. */
printf("\x1B[0;37;40mThis is white text on black.\n");

--
Wayne A. King
(ba...@torfree.net, wayne.k...@ablelink.org,
 wak...@idirect.com, Wayne_A_K...@compuserve.com)

Re:clrscr, gotoxy,textcolor for unix.


I am using a sun solaris machine.with a lot of restrictions so ncurses isn't
installed, curses gives errors...
anyways the other post gives the answer with ansi escape characters.. thanks
anyways !!!

Daniel

"Ilougino Rocha" <ro...@haisystems.com> schreef in bericht
news:3cfd2abc_2@dnews...

Quote
> Look at the ncurses library.  man ncurses on your linux machine.

> Daniel van den Oord wrote:

> > I made this program for school.
> > The Development platform was Windows 2k with borland c/c++ 5.02
> > now I have to port it to Unix GCC compiler...

> > I ran into a few problems like
> > clrscr() and gotoxy() I solved these with these 2 functions

> > ----code----
> > void GotoXY(int x, int y)
> > {
> >   printf("\033[%d;%df",x,y);
> > }

> > void clrscr(void)
> > {
> >   char a[80];
> >   printf("\033[2J");
> >   printf("\033[0;0f");
> > }
> > ----/code----
> > the only thing is that I also use
> > textattr is there also a way to do that very simplisticaly ?!?
> > thanks in advance !!!

Other Threads