aboutsummaryrefslogtreecommitdiff
path: root/examples/ex4.c
diff options
context:
space:
mode:
authorbellard <bellard>2005-04-14 23:56:18 +0000
committerbellard <bellard>2005-04-14 23:56:18 +0000
commit02af482c320ac71d9c85a89c1345c7e91855dabd (patch)
tree5f03592dd1843b51bf3818d5b8cf8534f67b95a6 /examples/ex4.c
parent7baf96810201273d76b29b37dea570517965c05c (diff)
downloadtinycc-02af482c320ac71d9c85a89c1345c7e91855dabd.tar.gz
tinycc-02af482c320ac71d9c85a89c1345c7e91855dabd.tar.bz2
moved examples
Diffstat (limited to 'examples/ex4.c')
-rwxr-xr-xexamples/ex4.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/ex4.c b/examples/ex4.c
new file mode 100755
index 0000000..3a3fed7
--- /dev/null
+++ b/examples/ex4.c
@@ -0,0 +1,25 @@
+#!./tcc -run -L/usr/X11R6/lib -lX11
+#include <stdlib.h>
+/* Yes, TCC can use X11 too ! */
+#include <stdio.h>
+#include <X11/Xlib.h>
+
+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;
+}