C++: How might one draw an ASCII character at a specific location in command prompt -


basically, want able create function can go:

draw('c', x, y); draw('h', x+1, y); draw('a', x+2, y); draw('r', x+3, y); 

and command prompt display char @ given x , y position

all figure out in research have include <windows.h>, have minimal experience with, , use pre-defined content in library.

this might started. see https://msdn.microsoft.com/en-us/library/windows/desktop/ms682073(v=vs.85).aspx more info.

#include <windows.h> #include <stdio.h>  void main() {     handle screenbuffer = createconsolescreenbuffer(         generic_read | generic_write,         file_share_read | file_share_write,         null,         console_textmode_buffer,         null);      if (screenbuffer == invalid_handle_value)     {         printf("createconsolescreenbuffer failed - (%d)\n", getlasterror());         return;     }      if (!setconsoleactivescreenbuffer(screenbuffer))     {         printf("setconsoleactivescreenbuffer failed - (%d)\n", getlasterror());         closehandle(screenbuffer);         return;     }      (int x = 0; x < 10; ++x)     {         dword numcharswritten;         writeconsoleoutputcharacter(screenbuffer, "x", 1, coord{(short)x, 1}, &numcharswritten);          sleep(1000);     }      closehandle(screenbuffer); } 

Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -