would like some ideas of how to acutally create my own cd function from scratch using C programming.I'm building a shell program in C.

4 Years
Discussion Span
Last Post by Ancient Dragon

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.