I keep on getting errors while trying to do file redirection.
I wrote the following code to test if the problem is with the complexity of my other programs or just the compiler.
Input is 4. Output should also be 4.Code:#include <stdio.h> int main() { int x; scanf("%d", &x); printf("%d", x); return 0; }
When I first tried doing it in the usual way, it worked. But when I tried file redirection, I got a long series of numbers. Idk if it's the address of the input or what.
Here's what I got:
File in.txt contains just the number 4.
I tried doing this in our lab; it worked perfectly fine.
I use MinGW compiler and my OS is Windows XP.
Also, what could be the problem if it's neither the compiler nor the OS? :/