Created
October 9, 2015 23:07
-
-
Save MoSal/af351add0efee1a8ccf7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <stdio.h> | |
#include <windows.h> | |
int main() { | |
printf("isatty(fileno(stdout)) returned %d\n", isatty(fileno(stdout))); | |
printf("_isatty(fileno(stdout)) returned %d\n", _isatty(fileno(stdout))); | |
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); | |
if (h == INVALID_HANDLE_VALUE) { | |
printf("GetStdHandle(STD_OUTPUT_HANDLE) failed.\n"); | |
return -2; | |
} | |
CONSOLE_SCREEN_BUFFER_INFO INFO; | |
if ( !GetConsoleScreenBufferInfo(h, &INFO) ) { | |
printf("GetConsoleScreenBufferInfo() failed.\n"); | |
return -1; | |
} | |
printf("cols=%d\n", (int)INFO.dwSize.X); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment