We need to include 3 extra headerfile for fcgi:
fcgi_stdio.h
fcgiapp.h
fastcgi.h

An infinite loop like while (FCGI_Accept() >= 0) is waiting for input.
3 environmentvariables gives what is the input:
REMOTE_ADDR = The remote address (of the other computer)
QUERY_STRING = The query
SCRIPT_NAME = The filename
printf is redirecty by fcgi and give the output to the client which has done the request
The first call to fcgi_accept gives a query_string of NULL, that means the fcgi server gets initiated.