i was dissapointed when i found that MS visual c++ doesn't have a built in gotoxy function. how is someone supposed to manipulate the console without it?

anyway, i found the API call which uses windows.h header, but it is weird, i have this code:

Code:
void gotoxy(int x, int y) 
{ 
HANDLE hConsoleOutput; 
COORD dwCursorPosition; 

dwCursorPosition.X = x; 
dwCursorPosition.Y = y; 
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); 
SetConsoleCursorPosition(hConsoleOutput,dwCursorPosition); 
}

void main()
{
	gotoxy(5,5);
	cout << "Hello there!";
}
but before it writes hello there, it moves the cursor to 5,5 and it just sits there blinking, until i press a key, then it continues.

why does this happen? why did they have to make it so hard on people?

any ideas would be nice