🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #24353

Re: XOpenDisplay

#24353
From: snail
Date: Fri, 22 Jan 1993 11:03
53 lines
2245 bytes
In article <1993Jan21.144250.5872@newton.bioch.ox.ac.uk>, mikes@bioch.ox.ac.uk (Mike Smith) writes:
> 
> Dear dudes,
> 
> I am a beginner into X programming, and am being frustrated by the following
> three lines:
> 
>   Display *display;
>   char *display_name = NULL;
>   display=XOpenDisplay(display_name);
> 
> (of course I have #include <X11/Xlib.h> and #include <X11/Xutil.h> at the top).
> 
> It seems to work Ok on those rare occasions when I can get on the computer where
> it is being executed

I assume you mean a remote login, or displaying on a different machine to the
one you are running on? If that is the case, then it maybe that you have not
told the application where to display itself. This can be done as follows

either

1) use the -display <display address> option on the command line.

   eg: myprog -display lsld5g:0.0
       runs the program myprog on machine lsld5g, using display 0 and screen 0

or

2) use the DISPLAY (unix) environment variable or DECW$DISPLAY (VMS) logical
   (is it a logical? or something else?).

   eg: setenv DISPLAY lsld5g:0.0
       to run the program:- myprog
       this has the same effect as 1).

   if you are using the machine at the console, but logged in on a seperate
   xterm (for example) you can setenv DISPLAY :0.0 or setenv DISPLAY unix:0.0

> from but otherwise I get a segmentation fault, when according
> to the man pages I should wither get a Display structure from XOpenDisplay, or a
> NULL.  I seem to be getting neither!

Funnily enough, we get a seg fault if the DISPLAY variable isn't set.

Hope it helps.
-- 
snail@lsl.co.uk      

"Washing one's hands of the conflict between the powerful and the powerless
 means to side with the powerful, not to be Neutral."
                                                     Quote by Freire.
                                                     Poster by OXFAM.
Technical Details
Message-ID: <1993Jan22.110312.2958@lsl.co.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!lsl!snail
References: <1993Jan21.144250.5872@newton.bioch.ox.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!lsl!snail
From: snail@lsl.co.uk
Newsgroups: comp.windows.x
Subject: Re: XOpenDisplay
Message-ID: <1993Jan22.110312.2958@lsl.co.uk>
Date: 22 Jan 93 11:03:12 GMT
References: <1993Jan21.144250.5872@newton.bioch.ox.ac.uk>
Organization: Laser-Scan Ltd., Cambridge
Lines: 53