According to the man page for popen:
The command argument is a pointer to a
null-terminated string containing a
shell command line. This command is
passed to /bin/sh using the -c flag;
interpretation, if any, is
performed by the shell.
So what you want is to escape the string for sh
to parse.
You do not need to escape the -list
argument, and you can try to escape the spaces instead of quoting the whole program name. I do not have a windows system here to test with but I would suggest
#define RUN_COMMAND "C:\\Program Files\\CA\\BrightStor\\ ARCserve\\ Backup\\ca_qmgr.exe -list"
int main() {
outputPointer = popen(RUN_COMMAND, "r");
...
}