You can't unless you also write your own file system, which I doubt you will want to do. The CD command is only good while the program is still running. After the program terminated the current directory reverts back to whatever it was before the program started. AFAIK there is no way to change that behavior.
The program you posted in another thread about this problem should work as far as I can tell. I never had a problem with chdir() unless I was giving it an invalid path.