Bonjour, les gars.
J'aimerais faire du CGI en C. J'ai écrit un code tout simple et ca marche pas. Mon serveur me renvoie un 500 Internal Server Error. Pouvez m'aider svp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #include <stdio.h> #include <stdlib.h> #include <time.h> #include <X11/Xutil.h> #include <X11/Xresource.h> #include <X11/Xlib.h> Display *dpy; int main(int argc, char *argv[]){ char *qs; if (! (dpy = XOpenDisplay(":0.0"))) { fprintf(stderr, "%s: dispositif %s injoignable\n", argv[0], XDisplayName(NULL)); return -1; } qs = getenv("QUERY_STRING"); fprintf(stdout,"Content-type: text/html\n\n"); fprintf(stdout,"<html><head></head><body><p>"); fprintf(stdout,"Query_String : %s\n",qs); fprintf(stdout,"</p></body></html>\n"); return 0; }
Partager