Using VC++ code to call ssh.exe to link linux machine, return 255
Yong Su
21
Reputation points
Hi, experts,
I need to call ssh.exe from VS c++ codes to call a linux machine. I tried following from the Visual Studio 2013 c++ codes:
MyString sExeName("ssh");
MyString sHost;
errno_t err = _set_errno(0);
intptr_t t = _wspawnlp(_P_WAIT, sExeName.c_str(), sExeName.c_str(), sHost.c_str(), NULL);
_get_errno(&err);
ssh.exe is in my path: "C:\Program Files\OpenSSH-Win64" But I now get t = 255, without error, meaning that it already started call the ssh.exe, but didn't return 0. What does 255 means?
If I open the dos command prompt, and call the following line, it works fine:
"ssh [hostxxxx]@永爱不变 . ~/.zzz.sh"
So what is wrong with my c++ codes?
Thanks,