I'm using popen to open a write pipe and send commands to an application. The problem is that the commands are only sent to the application when I close the pipe.
FILE * fp = open(target_app, "w");
fwrite(command, 1, command.size(), fp);
getchar(); //wait for a key, because I don't want to terminate the application
pclose(fp); // at this point, the command is sent
What could be possible wrong?