C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
WSSCRBUF.C
                                             Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
/* WSSCRBUF.C - Demonstrate setting the
 * size of a QuickWin window's
 * screen buffer
 * Note: The size is set here to an amount
 * smaller than the default size, but you can
 * set it larger as well
 */
 
#include <io.h>
#include <stdio.h>
 
#define NUMWINS     4       /* Number of windows */
#define OPENFLAGS   "w"     /* Access permission */
#define NUMLINES    100     /* Lines of text to write */
 
void main()
{
   int i;                   /* Loop variable */
   int nSize;               /* Old size of screen buffer */
   int nWinBufSize = 1500L; /* New size */
   int nRes;                /* Result */
   FILE *wp;                /* File pointer */
 
   /* Open a window */
   /* NULL arguments accept default characteristics */
   wp = _fwopen( NULL, NULL, OPENFLAGS );
   if( wp == NULL )
   {
      printf( "***ERROR:_fwopen\n" );
      exit( -1 );
   }
 
   /* Get the size of its screen buffer */
   nSize = _wgetscreenbuf( _fileno( wp ) );
   nRes = fprintf( wp, "Screen buffer holds %i chars\n", nSize );
 
   /* Reset the screen buffer size */
   nRes = _wsetscreenbuf( _fileno( wp ), nWinBufSize );
 
   /* Write many lines in the window */
   for( i = 0; i < NUMLINES; i++ )
   {
      nRes = fprintf( wp, "%i Windows!\n", i );
   }
   nRes = fprintf( wp, "\nWhen the program ends, click 'No'\n" );
   nRes = fprintf( wp, "and try using the scroll bars\n" );
 
   nRes = _wclose( _fileno( wp ), _WINPERSIST );
 
   exit( 0 );
}
 
 
 
 
                                    -♦-