Re: CGI written in C

From: Robert Harris (robert.f.harris_at_blueyonder.co.uk)
Date: 08/08/05


Date: Mon, 08 Aug 2005 10:03:16 GMT

Roman Mashak wrote:
> Hello, Pascal!
> You wrote on Mon, 08 Aug 2005 09:58:22 +0200:
>
> ??>> text/html\n\n"); ... ============== Testing with 'tcpdump' I found
> ??>> that web-server is sending "some stirng" and "some string2" in
> ??>> http-response. Why is it happening?
>
> PB> Because CGI are connected to the HTTP server thru stdin and stdout.
>
> PB> Where did you want to send "some string" to?
> I know that, I meant why does web-server send "some string" and "some
> string2" only, but not "some string3" (coming later) ?
>
> With best regards, Roman Mashak. E-mail: mrv@tusur.ru

Remember that printf is buffered; you need to call fflush(stdout) to
make sure that the output buffer gets written to the socket.

Perhaps you need to send more code details.

Robert



Relevant Pages

  • Re: is stuff before fork() executed?
    ... is the stuff before fork() function executed ... The default for stdout is "line" buffering when output ... in each of your printf statements causes the stdout ... buffer to be flushed immediately. ...
    (comp.os.linux.development.system)
  • Re: fork problem
    ... > the o/p is as follows.. ... > and insted of the printf statement if i put some thing else.. ... behaviour is caused because of the way that stdout behaves. ... character is written to the buffer. ...
    (comp.lang.c)
  • POSIX-ANSI equivalent?
    ... write(1, buffer, len); ... but the program (started by a server) doesn't work. ... stdout. ... practice, it would seem that on readstdin is redirected ...
    (comp.lang.c)
  • Re: POSIX-ANSI equivalent?
    ... write(1, buffer, len); ... stdout. ... practice, it would seem that on readstdin is redirected ... read and fread do have some differences in behavior; ...
    (comp.lang.c)
  • Re: getch() allocconsole freeconsole
    ... I am using the "official" solution to fix the printf() code, however getch() ... does not use stdin or stdout, instead it uses the _coninpfh variable as ...
    (microsoft.public.win32.programmer.kernel)