#undef UNICODE

#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <windows.h>

HANDLE hOut;

void Set( int x, int y, int color )
{
  COORD c;
  c.X = x, c.Y = y;
  SetConsoleTextAttribute(hOut, color);
  SetConsoleCursorPosition(hOut, c);
}

void HideCursor()
{
  CONSOLE_CURSOR_INFO cInf;
  GetConsoleCursorInfo(hOut, &cInf);
  cInf.bVisible = false;
  assert(SetConsoleCursorInfo(hOut, &cInf));
}

int main()
{
  hOut = GetStdHandle(STD_OUTPUT_HANDLE);
  HideCursor();

  int curx = 0;
  while (!kbhit())
  {
    Set(curx++, 1, 1 + rand() % 15);
    puts(" Hello world ");
    Sleep(100); // millisecons
  }  
  while (kbhit())
    getch();
  return 0;
}