Notifications
Clear all
Size of Terminal window
Topic starter
15/05/2020 12:01 pm
Hello,
May I ask how may we get the size of terminal window? so we can print the messages in right and left side of window.
after that task just the next message must be printed like that or all next messages also must be like that (left and right side)?
thanks
Quote
15/05/2020 12:09 pm
The classic size of terminal window is 25×80 (lines x columns), but you counting coordinates from 0.
And the whole communication with server (from start to end) must be set like this.
Hope it helps.
ReplyQuote
16/05/2020 12:51 pm
Hi, here is one program for calculating the number of rows and columns of your terminal window. Classic size is, like Ondrej said, 25x80, but mine has 30x120 so I hope this will be helpful.
#include <windows.h>
int main(int argc, char *argv[]) {
CONSOLE_SCREEN_BUFFER_INFO csbi;
int columns, rows;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
columns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
printf("columns: %d\n", columns);
printf("rows: %d\n", rows);
return 0;
}
Kokavec_Ondrej reacted
ReplyQuote
Forum Information
- 21 Forums
- 220 Topics
- 808 Posts
- 0 Online
- 7,045 Members
Our newest member: judislot888
Forum Icons:
Forum contains no unread posts
Forum contains unread posts
Topic Icons:
Not Replied
Replied
Active
Hot
Sticky
Unapproved
Solved
Private
Closed