Seriously....your code is ok...it must be your implementation...
Code:
#include <windows.h>
#include <iostream>
using namespace std;
void location(int x, int y)
{
HANDLE OutputH;
COORD position = {x, y};
OutputH = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(OutputH, position);
}
int main(void)
{
location(10,5);
cout << "Hello world";
return 0;
}
My guess is that you might be confusing the position as being relevant to pixels, when in fact the function relates to char position......if you put location(100,500); for instance, the function will fail...