Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

VC++ Question

This topic is 6272 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

There is a *.exe file which will return a value for my program future use. How can I call this exe file in the C++ program and how can I get the return value??? Thx!!! chikit

Share this post


Link to post
Share on other sites
Advertisement
Nckchan,

Depending on quite what you need when calling your external *.exe. (Whether you need a special command line arguments or enviroment) I'd use either one of the spawn functions.

For example to call the command "c:\bin\dosomething.exe 27 hello"
Using _spawnl

int _spawnl( int mode, const char *cmdname, const char *arg0, const char *arg1, ... const char *argn, NULL );

#include <process.h>

...
char* cmd = "c:\\bin\\dosomething.exe";
char* arg1 = "27";
char* arg2 = "hello";
int ret = _spawnl ( _P_WAIT, cmd, cmd, arg1, arg2, NULL );
...

Hope this helps

Tom.

Edited by - TomH on March 19, 2001 8:20:04 AM

Edited by - TomH on March 19, 2001 8:32:06 AM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!