|
From: Aaron B. <ab...@mi...> - 2003-04-05 00:56:05
|
> > Sorry Aaron, I don't know what could be causing the problem. However, > the fact that there are fewer write()s when the ouput is a file is > to be expected. Output is "block-buffered" if the output is not a > terminal, which means it saves up 4096 bytes before writing. If the > output is a tty, the data is "line-buffered", which means it is > written after every '\n'. This explains all the small writes to the terminal and the 4K to the file. > > There *shouldn't* be a need to flush stdout unless the program exits > abnormally (e.g. segfaults). Is the resulting file a multiple of > 4096 bytes long? What happens if you simply pipe the output through > more/less? Is it still truncated? The entire stdout to a file is 12315 bytes. If you remove all the header: Content-type: text/html^M ^M the file becomes 12288 (4096 * 3). The same problem is seen when i pipe the output to less. Thanks, -ab |