1 /*
2 @author:CodingMengmeng
3 @theme:C++获取当前目录
4 @time:2017-1-6 21:03:34
5 @blog:http://www.cnblogs.com/codingmengmeng/
6 */
7 #include <iostream>
8 #include <direct.h>
9 using namespace std;
10 /***********************************************************************
11 *函数名称: _getcwd
12 *函数原型: char * _cdecl _getcwd(char *_DstBuf,int _SizeInBytes)
13 *函数功能: 得到当前路径名称
14 *函数返回: 指向dir的指针
15 *参数说明: _DstBuf-路径字符串;_SizeInBytes-路径最大长度
16 *头 文 件: <direct.h>
17 *vs的版本: VS2013
18 *************************************************************************/
19 int main(void)
20 {
21 char buff[1000];
22 _getcwd(buff, 1000);
23 cout << "当前路径是:" << buff << endl;
24 getchar();
25 return 0;
26 }
运行结果:
原文链接: https://www.cnblogs.com/codingmengmeng/p/6257722.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/247122
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!