I understand that i am supposed to use chdir() but I just need an explanation as to why calling cd shell command through system or execvp() from a child process would not work? Thanks!!
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Because chdir
only modifies the environment of the current process. It can't touch the environment of the parent.
See also the link posted by tripleee.