change or report the size of a console
#include <sys/console.h>
int console_size( struct _console_ctrl *cc,
int console,
int set_rows,
int set_columns,
int *rows,
int *columns );
The console_size() function changes and or reports the size of the indicated console.
The argument cc is a pointer to a control structure that was returned by a previous call to console_open(). console has a value of 1 to represent the device named /dev/con1, a value of 2 for /dev/con2, and so on. A value of 0 for console indicates the default console (that is, the one used by console_open()). A value of (-1) for console indicates the currently visible console.
If set_rows is non-zero then the console size is changed to have that number of rows (if that size is supported by the system).
If set_columns is non-zero then the console size is changed to have that number of columns. (if that size is supported by the system).
If the pointers rows and columns are non-zero, then the resulting console size is placed in those variables.
The console_size() function returns 0 on success, and optionally sets rows and columns to the resulting screen size. If an error occurs, (-1) is returned, and errno is set.
console_active(), console_arm(), console_close(), console_ctrl(), console_font(), console_info(), console_open(), console_protocol(), console_read(), console_state(), console_write(), errno
#include <sys/console.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
void main()
{
struct _console_ctrl *cc;
int fd;
int rows, columns;
/*
* Open up a channel to the console driver
*/
fd = open( "/dev/con1", O_RDWR );
cc = console_open( fd, O_RDWR );
close( fd );
/*
* Get the size of the currently visible console
*/
console_size( cc, 0, 0, 0, &rows, &columns);
printf( "rows = %d, cols = %d\n", rows, columns );
/*
* Set /dev/con1 to 25x80 size
*/
console_size( cc, 1, 25, 80, 0, 0 );
/*
* Close the channel
*/
console_close( cc );
}
QNX
QNX