Not all Windows platforms support VT100. Only those Windows 10 and above (you may notice that PowerShell has colours).
If you are on Windows 10, you run your code above and it does not work; it means you have not activated it (it does not turn on by default).
There is a cross platform method (where you do not need to use Windows specific functions to get it started).
You just need to call system(" ")
before your control codes:
#include<stdio.h>
#include <stdlib.h> // Library for system() function
int main()
{
system(" "); // Start VT100 support
printf("123456789\n");
printf("\033A"); // And you are away :)
printf("abcdefghi\n");
return 0;
}
Or you can use SetConsoleTextAttribute()
to activate VT100 as described here
You can find further reference for Console Virtual Terminal Sequences from the Microsoft Documentation:
The behavior of the following sequences is based on the VT100 and derived terminal emulator technologies, most specifically the xterm terminal emulator. More information about terminal sequences can be found at http://vt100.net and at http://invisible-island.net/xterm/ctlseqs/ctlseqs.html.
This post also seems helpful as it describes different ways to start VT100