Article View: mod.computers.masscomp
Article #62detecting a graphics terminal in a program
From: Stan Barber
Date: Fri, 17 Oct 1986 20:24
Date: Fri, 17 Oct 1986 20:24
44 lines
1664 bytes
1664 bytes
Have you ever wondered how a program can detect if the user is at
a graphics terminal? It's really easy....
Here is a sample of how to do it with a fortran callable function written
in C:
/* is this a graphics device that I am on? */
/* $Header: isgraphics.c,v 1.1 86/10/16 16:19:02 lab Exp $
* By Stan Barber
* $Log: isgraphics.c,v $
* Revision 1.1 86/10/16 16:19:02 lab
* Initial revision
*
*
*/
#include <windefs.h>
#include <stdio.h>
isgraphics_()
{
WINDOWDATA WD;
int i;
i=ioctl(fileno(stdout),WIOCGETD,&WD);
if (i == 0) return(1);
return(0);
}
This will return a 1 if you are on a graphics terminal and 0 if not.
I would like to make this a logical, but the documentation is
not specific on how to do this...Maybe a Westford person can tell us...
Here is a sample program to use to test this:
program testidgr
integer j
j = isgraphics(0)
print *,j
end
The compiler command to use is:
f77 -o testidgr testidgr.f isgraphics.c
If anyone has any more shorts to contribute, please feel free.
Technical Details
Message-ID:
<1130@soma.bcm.tmc.edu>Path:
arc1-ca.pugleaf.net!utzoo!decvax!ucbvax!ucbcad!nike!sri-spam!rutgers!caip!clyde!cbatt!cbosgd!soma!soma.bcm.tmc.edu!sobShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!decvax!ucbvax!ucbcad!nike!sri-spam!rutgers!caip!clyde!cbatt!cbosgd!soma!soma.bcm.tmc.edu!sob From: sob@soma.bcm.tmc.edu.bcm.tmc.edu (Stan Barber) Newsgroups: mod.computers.masscomp Subject: detecting a graphics terminal in a program Message-ID: <1130@soma.bcm.tmc.edu> Date: Fri, 17-Oct-86 16:24:01 EDT Article-I.D.: soma.1130 Posted: Fri Oct 17 16:24:01 1986 Date-Received: Sat, 18-Oct-86 15:31:22 EDT Sender: masscomp@soma.bcm.tmc.edu Organization: Masscomp Users' Society Lines: 44 Approved: masscomp@soma.uucp