C++获取当前目录
2017-01-06 21:05
225 查看
/* @author:CodingMengmeng @theme:C++获取当前目录 @time:2017-1-6 21:03:34 @blog:http://www.cnblogs.com/codingmengmeng/ */ #include <iostream> #include <direct.h> using namespace std; /*********************************************************************** *函数名称: _getcwd *函数原型: char * _cdecl _getcwd(char *_DstBuf,int _SizeInBytes) *函数功能: 得到当前路径名称 *函数返回: 指向dir的指针 *参数说明: _DstBuf-路径字符串;_SizeInBytes-路径最大长度 *头 文 件: <direct.h> *vs的版本: VS2013 *************************************************************************/ int main(void) { char buff[1000]; _getcwd(buff, 1000); cout << "当前路径是:" << buff << endl; getchar(); return 0; }
运行结果:
相关文章推荐
- 获取c++执行文件的当前目录
- C++获取当前目录
- c++获取当前目录
- C++获取当前目录
- C++ 获取当前目录
- C++获取当前目录
- C++ 获取当前进程运行目录(visual studio 调试状态下)
- 纯C/C++程序中如何获取当前目录和程序目录
- C++ 代码 获取当前目录
- c++ 获取当前用户的根目录
- C++ 获取当前工作目录的方法
- c++ 设置和获取当前工作目录
- c++获取当前目录
- C++ 删除、重命名文件 、获取当前目录所有文件代码
- c/c++中获取当前目录
- #QT深坑# QT获取当前EXE所在目录(有坑!!!)
- C++获取当前日期时间的方法
- 使用C++获取文件路径,已获取当前路径为基础
- ruby 中如何获取当前的文件名和目录
- C++设置和获取当前工作路径