Shell VB App From C++ Code
Hello,
I have an open source C++ command line tool of which I'm trying to manipulate the source code to modify its functionality for my personal use.
I have very limited knowledge of C++, and I need some help on how to synchronously shell another program (a VB app for that matter) with the initial argument line that was passed to the original C++ tool. The arguments parts is as troublesome as the "shelling" part because I'm not sure how to rebuild the arg. line from the argv[] array.
Re: Shell VB App From C++ Code
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string>
int main(int argc, char **argv)
{
FILE *proc;
std::string command = "vbapp.exe";
for(int i=1;i<argc;i++)
{
command += " " + argv[i];
}
if (proc = _popen(command.c_str(), "rt"))
{
while(fgetc(proc) != EOF);
if (feof(proc))
{
return _pclose(proc);
}
else
{
return 1;
}
}
else
{
return 1;
}
}