I have a console application written in c++. It simply reads an integer from standard input(keyboard) and writes another integer to standard output(screen). Now I want to give some tests to that program and check its answers using another program. In another words, I want to write electron judge for that program. I want that program(which I want to test) to read from file and write to file without changing source code. How can I do that. I tried assigning input&output to files before executing c++ program, but it did not worked.
assign(input,'temp.in');
reset(input);
assign(output,'temp.out');
rewrite(output);
exec('domino.exe');
close(input);
close(output);