Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-26-2005, 06:42 PM   #1
LQ Newbie
Registered: Aug 2004
Location: Kergunyah Australia
Distribution: Red Hat
Posts: 10

Rep: Reputation: 0
Question XOpenDisplay() fails

/* connect to the display */
disp = XOpenDisplay (":0");
if (disp == NULL) {
printf ("Cant find display\n");
exit (-1);

The code above runs OK on RH 7.2 but always returns a null
in the RH 9 system just generated.
Documentation is no help in telling me why??

KDE is fine and the XFree log shows no errors

Any ideas anyone?
Old 01-26-2005, 11:42 PM   #2
Registered: May 2004
Posts: 552

Rep: Reputation: 31
I'm not sure, but here is a small program that I wrote to power down monitor and it works on all redhat versions that I've used since 7.1 to enterprise WS 3.0.
I think the difference is that I'm using NULL for the argument.

//usr/bin/gcc -Wall -O2 -DNDEBUG -lgdk -o ssactive ssactive.c ; strip ssactive ; exit

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/extensions/dpms.h>

int main(int argc, char *argv[]) {
    Display *display;
    if (display) {
        if (argc>1 && !strcmp("ss",argv[1])) {
        } else {
    return 0;


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
kdm: IO Error in XOpenDisplay erik_wout_ew2 Linux - Software 3 10-03-2010 08:09 AM
DHCP fails, IP fails, packet framing errors? alonsomosely Fedora 2 09-17-2004 12:22 PM
Encrypted Reiserfs Fails to Mount -- Reiserfsck Fails as Well antic Linux - Hardware 0 07-30-2004 05:32 PM
can't boot: IO Error in XOpenDisplay jeffreybluml Linux - Newbie 0 06-11-2004 07:41 AM
Headless, error on XOpendisplay chrismcnally Linux - General 0 03-20-2004 12:11 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:19 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration