Using sprintf with WriteConsoleOutput
Feb 27, 2009 at 10:53am UTC
So I have a task to use sprintf with WriteConsoleOutput. Now my problem is I'm not to sure how I can use sprintf() to display to a coord on the screen.
So if I'm using this function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
void BlitArrayToConsole( CHAR_INFO (&OffScreenBuffer)[WINDOW_HEIGHT_SIZE][WINDOW_WIDTH_SIZE] )
{
COORD offscreenBufferBuff;
offscreenBufferBuff.X = WINDOW_WIDTH_SIZE;
offscreenBufferBuff.Y = WINDOW_HEIGHT_SIZE;
COORD dest;
dest.X = dest.Y = 0;
SMALL_RECT rt;
rt.Top = 0;
rt.Bottom = WINDOW_HEIGHT_SIZE;
rt.Left = 0;
rt.Right = WINDOW_WIDTH_SIZE;
WriteConsoleOutput(GetStdHandle(STD_OUTPUT_HANDLE), &OffScreenBuffer[0][0], offscreenBufferBuff, dest, &rt);
}
How exactly would I go about using sprintf() on the screen at the coords of etc - 10y and 10x to say "Hello World".
Just something really basic like that?
Thanks,
Myth
Feb 27, 2009 at 7:23pm UTC
sprintf() just formats a string, using the printf() format specifiers. It doesn't display the result in any way.
Feb 28, 2009 at 4:51am UTC
So your saying I'd have to still use printf() to display the c-string?
Topic archived. No new replies allowed.