C examples for File:File Operation
Uses freopen( ) to redirect stdout to a file called OUTPUT:
#include <stdio.h> int main(void) { char str[80];/*w w w. j a va 2 s . co m*/ freopen("OUTPUT", "w", stdout); printf("Enter a string: "); gets_s(str); printf(str); return 0; }