diff options
Diffstat (limited to 'libterm/examples/detect_screen_size.c')
-rw-r--r-- | libterm/examples/detect_screen_size.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libterm/examples/detect_screen_size.c b/libterm/examples/detect_screen_size.c new file mode 100644 index 0000000..f309253 --- /dev/null +++ b/libterm/examples/detect_screen_size.c @@ -0,0 +1,39 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <term.h> + +int main() +{ + struct term_screen ts; memset( &ts, 0, sizeof(ts) ); + + if ( term_init( &ts ) == -1 ) + printf("Some err when init\n"); + + term_clr_scr( &ts ); + + { + char buf[32]; + int c; + c = term_get_maxcol( &ts ); + snprintf( buf, 32, "MaxCol:%d\n", c ); + write( ts.ofd, buf, strlen(buf) ); + } + + { + char buf[32]; + int r; + r = term_get_maxrow( &ts ); + snprintf( buf, 32, "MaxRow:%d\n", r ); + write( ts.ofd, buf, strlen(buf) ); + } + + + sleep(3); + + term_clr_scr( &ts ); + + term_set_orig_mode( &ts ); + + return 0; +}
\ No newline at end of file |