hi i want to read the output of my program multiple times. Some thing like if i pass X i get the output and i display it, then again if i pass Y i get the output and i display it. without restarting the process. to try it i have made a c program
#include<stdio.h>
int main()
{
int i;
int j;
while(scanf("%d", &i))
{
for(j = 0; j<=i;j++)
printf("%d\n",j);
}
return 0;
}
and now i'm interfacting it with C#, where when i enter a text in the textbox it is passed through the redirect standardinput (a streamwriter) to the program and to read the output i call it's standardoutput (a streamreader).readtoend().
But it is not working for me. As it goes in waitstate till the stream returns some indication telling end has been read.
How can i achieve such a thing?
I tried the asynchronous read too where i call the beginoutputread method, but then i won't know when the read has been finished! One way can be for me to add a marker in my original program to indicate that output is over for the current input. Is there any other way for me to achieve it?