#include <X11/Xlib.h> 
#include <assert.h>  
#include <unistd.h>
#include <iostream.h>

#define NIL (0)       // A name for the void pointer

main() {

   Display *dpy = XOpenDisplay(NIL);
   Drawable d;
   assert(dpy);

   int blackColor = BlackPixel(dpy, DefaultScreen(dpy));
   int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));

   Window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 
                                  200, 100, 0, blackColor, whiteColor);

   XMapWindow(dpy, w);
   GC gc = XCreateGC(dpy, w, 0, NIL);

   XFontStruct **font_info;
   char *str1 = "ummm.. ?";
   char *fontname = "9x15";
   if((*font_info = XLoadQueryFont(dpy,fontname)) == NULL) {
      cout << "Cannot open 9x15 font\n";
      exit(-1);
   }

   XDrawString(dpy, w, gc, 10, 10, str1, strlen(str1)); 

   XFlush(dpy);
   sleep(5);
}
