是什么在windows _chdir和SetCurrentDirectory之间的区别? [英] What is the difference between _chdir and SetCurrentDirectory in windows?

查看:393
本文介绍了是什么在windows _chdir和SetCurrentDirectory之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有我应该选择一个比其他任何区别?

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

推荐答案

他们达到同样的效果,但属于不同的API,因此他们返回结果,并以不同的方式报告错误。

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

如果您已经使用其它程序无论从API,挑一个。如果不是,SetCurrentDirectory()是更Windows式,而_chdir()是更类似于POSIX API。如果你有一个头脑端口code,比方说,Linux平台上,使用_chdir();如果你知道你将只运行在Windows平台上的code,SetCurrentDirectory()。

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().

这篇关于是什么在windows _chdir和SetCurrentDirectory之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆