freopen

#include < stdio.h >
#include < stdlib.h >
#include < string.h >

void main(int argc, char *argv[])
{
    FILE *fp;
    fp=freopen("/tmp/debug.log","w",stdout);
    printf("Content-type:text/html\n\n");
    printf("\n");
    printf("\n");
    printf(" \
           CONTENT=\"text/html; charset=x-euc\">\n");
    printf("test\n");
    printf("\n");
    printf("\n");
    printf("

test

\n"); printf("\n"); printf("\n"); }