Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcdc!stroyan From: stroyan@hpfcdc.HP.COM (Mike Stroyan) Newsgroups: comp.sys.hp Subject: Re: HP GKS GESC_FILDES question? Message-ID: <5570179@hpfcdc.HP.COM> Date: 13 May 89 02:01:05 GMT References: <47500008@uxe.cso.uiuc.edu> Organization: HP Ft. Collins, Co. Lines: 65 > To do this you have to have a file descriptor > for the open workstation you are using. To get > this file descriptor you need to call a special > "escape" function: gescape. You need to use the GKS "escape" function, gesc(), rather than the Starbase "escape" function, gescape(). The program below demonstrates the use of GESC_FILDES for a workstation display device. Mike Stroyan, stroyan@hpfcla.hp.com /* * test hpgks GESC_FILDES ESCAPE */ #include #include #define NBYTES 0 #define ERROUT stderr #define CONID 5 #define WSTYP 5 main() { int i, fildes; int ia[3], oa[3], il, lidr, lodr, dummy, errind; char idr[80], odr[80]; /* * Open the workstation and GKS */ gopks( ERROUT, NBYTES ); gopwk( 1, CONID, WSTYP ); gacwk( 1 ); /* * Pack data record */ ia[0] = 1; /* Workstation id */ gprec(1, ia, 0, 0, 0, 0, 0, 1, &errind, &lidr, idr); if ( errind ) fprintf(stderr, "GKS error %d in function %s\n", errind, "gprec"); /* * Call gesc to determine active file descriptor */ gesc(GESC_FILDES, lidr, idr, 1, &lodr, odr); /* * Unpack data record */ gurec(lodr, odr, 1, 0, 0, &errind, &il, oa, &dummy, 0, &dummy, 0, 0 ); if ( errind ) fprintf(stderr, "GKS error %d in function %s\n", errind, "gurec"); if ( il > 0 ) { fildes = oa[0]; printf("fildes = %d\n", fildes); } /* * Close the workstation and shut down GKS. */ gdawk ( 1 ); gclwk ( 1 ); gclks(); }