函数名: freopen
功 能: 替换一个流
用 法: #include <stdio.h>
FILE *freopen(char *filename, char *type, FILE *stream);
程序例:
#include <stdio.h>
int main(void)
{
/* redirect standard output to a file */
if (freopen("OUTPUT.FIL", "w", stdout)
== NULL)
fprintf(stderr, "error redirecting\
stdout\n");
/* this output will go to a file */
printf("This will go into a file.");
/* close the standard output stream */
fclose(stdout);
return 0;
}