C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
FWOPEN.C
                                             Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
/* FWOPEN.C - Demonstrate opening QuickWin windows
 * with _fwopen
 */
 
#include <io.h>
#include <stdio.h>
 
#define OPENFLAGS "w"              /* Access permission */
 
void main()
{
    struct _wopeninfo wininfo;     /* Open information */
    char wintitle[32]="QuickWin "; /* Title for window */
    FILE *wp;                      /* FILE ptr to window */
    int nRes;                      /* I/O result */
 
    /* Set up window info structure for _fwopen */
    wininfo._version = _QWINVER;
    wininfo._title = wintitle;
    wininfo._wbufsize = _WINBUFDEF;
 
    /* Check current 'exit behavior' setting */
    /* Test should be true, since default is _WINEXITPERSIST */
    /* So set new behavior to prompt user */
    if( _wgetexit() == _WINEXITPERSIST )
       _wsetexit( _WINEXITPROMPT );
 
    /* Create a new window */
    /* NULL second argument accepts default size/position */
    wp = _fwopen( &wininfo, NULL, OPENFLAGS );
    if( wp == NULL )
    {
        printf( "***ERROR: _fwopen\n" );
        exit( -1 );
    }
 
    /* Write in the window */
    nRes = fprintf( wp, "Hello, QuickWin!\n" );
 
    /* Close the window */
    nRes = fclose( wp );
 
    /* On exiting anywhere, user is prompted
     *  to keep window on screen or not
     */
    exit( 0 );
 
}
                                    -♦-