Posted on 2003-03-04
Read the following 2 programs and read the question below....
this is popentest2.cpp
#define BUFSIZE 100
fp = _popen("path of popentest1.exe","r+");
printf(" error reading file");
while (fgets(buf, BUFSIZ, fp) != NULL)
(void) printf("%s", buf);
this is popentest1.cpp.....
printf(" this is testing.... ");
printf("%d",2*a);// this shud return 10....2*5
2. run popentest1.cpp initially to create the exe file. after that stop it.
1. run popentest2.cpp
now i want to read what was written in the stream of popentest1.exe and write into the stream of popentest1.exe...that is to be able to read from it and to supply arguments to popentest1.exe.
However i want it to be done without pressing enter. when we use cin, the prompt is waiting for enter to be pressed, plz help me, i want it automated that is after some parameter is written to popentest1.exe it should continue without waiting for enter to be pressed.
i dont mind using any other function but i need a solution to this. Please kindly help. if i pass '\n' as parameter also it is not working properly i think.
or to put it simply...
just give me 2 programs, i should be able to start one program from the other read from that program and write to it...using popen or anything else in vc++...just supplying the parameters and the programs shud not wait for "enter" . Even if u send '\n' parameter also its fine.