Hello all, I have two console-related functions that need to be supported "across the board", but I'm a little short on time, unfortunately. So far I've only got the MSWindows version coded. Any help or advice would be greatly appreciated!
Code:#include "stdlib.h" // for size_t #if defined( WIN32 ) || defined( MSWIN ) #include "windows.h" // zero-based indexing void set_row_and_column_character( size_t row, size_t column, unsigned char character ) { COORD position; position.X = column; position.Y = row; SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), position ); putchar( character ); } // for resizeable screens, calculation should be done dynamically void get_screen_height_and_width( size_t* height, size_t* width ) { CONSOLE_SCREEN_BUFFER_INFO info; GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &info ); *width = info.srWindow.Right; *height = info.srWindow.Bottom - info.srWindow.Top; } #else #if defined( NextPlatformNamePlaceHolder_ ) // platform implementation #else #error Console platform not specified #endif



LinkBack URL
About LinkBacks



