How can I change standart input/output of another program?
Posted
by Azad Salahli
on Stack Overflow
See other posts from Stack Overflow
or by Azad Salahli
Published on 2010-06-08T19:32:34Z
Indexed on
2010/06/08
19:42 UTC
Read the original article
Hit count: 229
pascal
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);
© Stack Overflow or respective owner