Any way to handle an exception thrown from called c# exe in c++? -


i wonder way handle inner exceptions of called exe c++ code?

my sample code:

char *fprog = "..\\consoleapp\\ezf\\encryptzipftp.exe"; char *fpath = "c:\\users\\min\\desktop\\foto"; char *fpass = "wxrfsdmkh1994wxrmk";  char command[500]; sprintf (command, "%s %s %s", fprog, fpath, fpass);   try  {    system(command); } catch(exception &err) { } 

you need check return value system() (as need check return value c functions). this:

int status = system(command); if (status == -1)     std::cerr << "oops, not launch " << command << std::endl;  int rc = wexitstatus(status); if (rc != 0)     std::cerr << "error " << command << ": " << rc << std::endl; 

if child program @ well-behaved, return nonzero indicate failure when unhandled exception occurs.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -