Thread View: mod.computers.masscomp
1 messages
1 total messages
Started by Stan Barber
Fri, 17 Oct 1986 20:24
detecting a graphics terminal in a program
Author: 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads