Новые технологии информационного сервиса в Internet

Пример С-программы


#include <stdlib.h>;

#include <sys/types.h>;

main()

{

long i,n,uid;

char input_ch[1024];

char *env;

env = getenv("CONTENT_LENGTH");

/* Here we recieve a length */

sscanf(env,"%d",&n);

/* of input stream and form */

for(i=0;i<;n;i++)

/* command line */



{ input_ch[i]

= getchar(); }

input_ch[i] = '\000';

printf("Content-type:

text/html\n\n"); /* First message of a CGI Programme */

/* This message must be a first one */

/* in output sream. */

printf("<TITLE>

C-cgi script.(example#1)</TITLE>\n");

printf("<H3><I>

Russian Research Center \"Kurchatov Institute\"<I></H3>\n");

c_uid = -1;

sscanf(input_ch,"uid=%ld",&uid);

/* Transform input data */

printf("Input

Nuber:%ld.<BR><HR>",uid);

exit(0);

}



Содержание раздела