Re: popen() works, but now?



Ronald Bultje wrote:

Hi again,

I learned to use FILE *some_pipe = popen(command,"w"); to open a program
and write some data to it's stdin. The program receives the data I send to
it (press enter to continue -> fprintf(some_pipe, "\n");, for example), but
for some reason, this takes effect *after* I close my main application.
Should I make this a thread or something? It is supposed to receive and
process this data *while* the main application is running.


I believe the output from fprintf is buffered - you probably need to flush the stream:

fflush(some_pipe);

Regards,
Timothy M. Shead
tshead k-3d com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]