I'm writing a program to check whether the submit code is right or not. Here is some of my code...
Process submitProg;
StreamWriter progInput;
string input;//it will be submitProg's standard input
//initialization
//...
submitProg.Start();
progInput = submitProg.StandardInput;
progInput.Write("{0}",input);
progInput.Close();
progInput.Dispose();
while(!submitProg.HasExited)
if(timeOUT)
submitProg.Kill();
Amazingly it will get stuck at the line progInput.Write("{0}",input);
while input is big enough and the submit program didn't read anything.
Some submit code might be tricky like while(1);
doing nothing. I can kill the process when the input file is small enough. On the contrary, if the input file is bigger, the program won't check for timeout and get stuck while reading input.
Do I have any solution to avoid getting stuck in the code that doesn't read anything. Thanks.