FreeBASIC  0.91.0
io_width.c
Go to the documentation of this file.
1 /* console width() function */
2 
3 #include "../fb.h"
4 #include "fb_private_console.h"
5 
6 int fb_ConsoleWidth( int cols, int rows )
7 {
8  if( !__fb_con.inited )
9  return (80 | (25 << 16));
10 
11  BG_LOCK( );
13  BG_UNLOCK( );
14 
15  int cur = __fb_con.w | (__fb_con.h << 16);
16 
17  if ((cols > 0) || (rows > 0)) {
18  BG_LOCK();
19 
20  if (cols <= 0)
21  cols = __fb_con.w;
22  if (rows <= 0)
23  rows = __fb_con.h;
24  fb_hTermOut(SEQ_WINDOW_SIZE, rows, cols);
25 
26  BG_UNLOCK();
27 
28  fb_ConsoleClear( 0 );
29  }
30 
31  return cur;
32 }