C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WOPEN.C
                                             Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
/* WOPEN.C - Demonstrate opening a QuickWin
 * window with _wopen
 */
 
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
 
#define PERSISTFLAG   _WINNOPERSIST
#define OPENFLAGS     _O_RDWR
 
void main()
{
   int wfh;        /* File handle for window */
   int nRes;       /* Window write results */
   struct _wopeninfo wininfo; /* Open information */
 
   /* Set up window open information */
   wininfo._version = _QWINVER;
   wininfo._title = "Window Closing";
   wininfo._wbufsize = _WINBUFDEF;
 
   /* Open a window with _wopen */
   /* NULL second argument accepts default size */
   wfh = _wopen( &wininfo, NULL, OPENFLAGS );
   if( wfh == -1 )
   {
       printf( "***ERROR: On _wopen\n" );
       exit( -1 );
   }
 
   /* Write in the window */
   nRes = _write( wfh, "Windows Everywhere!\n", 20 );
 
   /* Close the window with _wclose */
   nRes = _wclose( wfh, PERSISTFLAG );
 
   exit( 0 );
}
                                    -♦-