diff options
Diffstat (limited to '05/tcc-0.9.27/examples/ex4.c')
-rwxr-xr-x | 05/tcc-0.9.27/examples/ex4.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/05/tcc-0.9.27/examples/ex4.c b/05/tcc-0.9.27/examples/ex4.c new file mode 100755 index 0000000..f92c0da --- /dev/null +++ b/05/tcc-0.9.27/examples/ex4.c @@ -0,0 +1,26 @@ +#!/usr/local/bin/tcc -run -L/usr/X11R6/lib -lX11 +#include <stdlib.h> +#include <stdio.h> +#include <X11/Xlib.h> + +/* Yes, TCC can use X11 too ! */ + +int main(int argc, char **argv) +{ + Display *display; + Screen *screen; + + display = XOpenDisplay(""); + if (!display) { + fprintf(stderr, "Could not open X11 display\n"); + exit(1); + } + printf("X11 display opened.\n"); + screen = XScreenOfDisplay(display, 0); + printf("width = %d\nheight = %d\ndepth = %d\n", + screen->width, + screen->height, + screen->root_depth); + XCloseDisplay(display); + return 0; +} |