Alex Rivera | Logout

What is the difference between _chdir and SetCurrentDirectory in windows?

Asked 2011-09-25T07:11:41.863
9

Are there any difference that I should choose one over the other?

Edit
Report

1 Answer

11

They achieve the same result but belong to different APIs, so they return their results and report errors in different ways.

If you're already using other routines from either API, pick that one. If not, SetCurrentDirectory() is more "Windowsy", while _chdir() is more similar to the POSIX API. If you have a mind to port the code to, say, a Linux platform, use _chdir(); if you know you will only ever run the code on Windows platforms, SetCurrentDirectory().

answered 2011-09-25T07:34:39.603

Your Answer