#include <iostream>
#include <direct.h>
using std::string;
/***********************************************************************
*函数名称: _getcwd
*函数原型: char * _cdecl _getcwd(char *_DstBuf,int _SizeInBytes)
*函数功能: 得到当前路径名称
*函数返回: 指向dir的指针
*参数说明: _DstBuf-路径字符串;_SizeInBytes-路径最大长度
*头 文 件: <direct.h>
*vs的版本: VS2013
*************************************************************************/
int main()
{
char buff[1000];
_getcwd(buff, 1000);
std::cout << "当前路径是:"<<buff<<"\n";
getchar();
return 0;
}
c++获取当前目录
最新推荐文章于 2025-06-27 10:04:11 发布