-
What is the output of this program in the file?
#include <iostream>
int main ()
{
freopen ("Sample.txt", "w", stdout);
printf ("This is redirected to a file");
fclose (stdout);
return 0;
}
-
- This is redirected
- Compilation Error
- This is redirected to a file
- Sample.txt
- None of these
Correct Option: C
In this program, We are sending the text to the file by opening the file using the function freopen.