|
-
Jun 6th, 2013, 01:39 PM
#1
Thread Starter
Hyperactive Member
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.
"And Now I'm Lika Major Threat, Cause I Remind U Of The Things U Were Made To Forget!" - (2PAC)
"Now They Label Me a Lunatic, Couldn't Care Less, Death or Success is What I Quest, Cause I'm Fearless!" - (2PAC)
" There's a light at the end of every tunnel, just pray it's not a train!! "
I am 100% addicted to Tupac. What about you?
I am 24% addicted to Counterstrike. What about you?
The #1 Tupac Fans Web Site | The Official Tupac Web Site
-
Jul 2nd, 2013, 11:37 AM
#2
New Member
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;
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|