Search code examples
ccursordosturbo-cansi-escape

C ANSI Escape Code


How can I do cursor control with ANSI using escape sequences using Turbo C? Here I've provided a code, but it's not yet working in my TurboC.

main()
{
   while( getche() != '.' )
      printf("\x1B[B");
}

Solution

  • Apart from the possibility that that output may be line buffered (meaning nothing may appear until you send a newline), you should probably also ensure that ANSI.SYS is loaded, since it's the device driver responsible for interpreting those sequences.

    But I'm wondering why you're doing this. From memory (admittedly pretty faded memory), Turbo C has calls for doing this sort of thing, gotoXY and clrscr and such.