Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道我应该使用 chdir() 但我只需要解释为什么通过系统调用 cd shell 命令或从子进程调用 execvp() 不起作用?谢谢!!
因为chdir只修改了当前进程的环境。它不能触及父母的环境。
chdir
另请参阅Tripleee 发布的链接。