Hi, i'm trying to output a character in the very bottom of the console screen, far right hand side. However, the cursor keeps going onto a new line once the character has been placed in the corner. Is there any format specifier that can be included within the cout statement to prevent this from happening?
maybe if you set the width to 80 and right aligned
EDIT: ie cout.width=80;
Thanks, it still made no difference. The cursor still went onto the next line.
I have no idea how to prevent it from going to a newline at the end of the screen... you could do it with WinAPI calls, but I don't think that's what you want
might help, depending on what you are trying to do
not 100% sure this will work but it should. print a backspace immediately after whatever your printing....
gotoxy(bottom right corner)
cout<<"your thing here\b";
might do the trick.
// Sets the cursor position
void SetCursor(int x, int y)
// go to the specified location
dwCursorPosition.X = x;
dwCursorPosition.Y = y;
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
cout << "X";
harryp, does that work? Once you move the cursor and then print a character, doesn't the cursor scroll off the screen regardless?
I've tried everyones suggestions, but none of them seem to do the trick. The cursor still moves onto the next line by default.
I gather then there is nothing that can be done to prevent the new line from occuring?