Hello friend, you can change the std out in this way:
Code:
#include <stdio.h>
#include <stdlib.h>
main()
{
int i=0;
int j;
j =4;
fprintf(stdout,"Value of i and j are %d %d\n",i, j);
fprintf(stderr,"Value of i and j are %d %d\n",i, j);
}
In this way you can redirect the output into stderr or stdout.
If you want redirect the stdout into file, you must insert into fprintf the file descriptor.
For example. If *fp is a file descriptor, when you insert into fprintf(fp,".....");, it write output into file