I am creating mfc application to change directory
While you have got responses telling you how to do this (example - by using
SetCurrentDirectory
), be aware that this may not achieve what you seem to be trying to do here. It will only set the current directory for your process. Once your process exits, any other process you start will not start in this directory. Unlike in the DOS days, you cannot set a global current directory.
[Edit]
-------
Posted this as a comment but thought the trivia would be interesting in the answer too.
In the DOS days what chdir did was to call INT 21h (function 3Bh) to set the current directory. This was a global setting. In addition the current directory for each drive was also separately remembered and maintained.
Of course if you used a custom shell (and not command.com) then this behavior could vary.