I need to call ssh.exe from VS c++ codes. I tried following from the Visual Studio 2013 c++ codes:
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: "%SYSTEMROOT%\System32\OpenSSH". But I always get t = -1, and err = 2, meaning that they cannot find the file. Why is that? What is the correct way to call the ssh.exe?