CreateProcess() c++ file not found

后端 未结 4 1034
星月不相逢
星月不相逢 2021-01-22 15:18

I\'m trying to use CreateProcess to start a child process, however I keep getting error 2, which, according to the documentation is file not found.

4条回答
  •  走了就别回头了
    2021-01-22 15:35

    test.exe is never being looked up in the directory that the calling exe lives in. It is being looked up in the current directory which is a per-process path variable. Maybe the current directory is not pointed to where test.exe lives. You should also never rely on that because it can change arbitrarily (for example by using the file dialogs, or when the parent process changes it).

提交回复
热议问题