I have a question, here is my original code in the testchdir.c file:
#include
#include
#include
int main(int a
It's because the shell starts a new process for your program, and you only change the current directory in that new process. The shells process will be unaffected.
Unfortunately (for you) there's no real good (or legal) way to change the working directory of the parent process (the process of the shell).