You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Andy Hanson <an...@yahoo.com> on 2000/05/12 03:31:26 UTC

Trouble with stdout/write on CGI exectable.

I've been playing around with writing an actual
exectuable cgi script in apache under linux.
 
Basically I output html through printf.  However
for some wacky reason, it doesn't like me to do
direct writes through stdout.
 
write craps out apache.
fwrite works just fine.

Basically by crapping out apache I mean that
it gives me the internal server error page.
 
ex.
 
int fd;
int len;
char fwrite_string[]="this will work\n";
char write_string[]="this wont work but should\n";
 
/* case 1 will work */
len=strlen(fwrite_string);
fwrite(fwrite_string,1,len,stdout);
 
/* case 2 won't work */
fd=fileno(stdout);
len=strlen(write_string);
write(fd,write_string,len);
 
Obviously both cases work just fine outside the
apache environment.  But it doesn't allow me to
use write, to talk to stdout.  Please help.
 
How can I work around this little wrinkle.
 
andrew_g_hanson@yahoo.com


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Re: Trouble with stdout/write on CGI exectable.

Posted by Andy Hanson <an...@yahoo.com>.
heh.  forgive me.  I  had forgotten to do an fflush on stdout.
The code synched up fine outside the apache env, but
I was just getting lucky.


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com