Say i have an exe, lets say sum.exe. Now say the code for sum.exe is
void main () { int a,b; scanf (\"%d%d\", &a, &b); printf (\"%d\", a+b); } >
This is my solution and it worked:
sum.cpp
#include "stdio.h" int main (){ int a,b; scanf ("%d%d", &a, &b); printf ("%d", a+b); return 0; }
test.cpp
#include #include int main(){ system("./sum.exe < data.txt"); return 0; }
data.txt
3 4
Try this solution :)