系统相关
首页 > 系统相关> > c++获取当前进程所在位置

c++获取当前进程所在位置

作者:互联网

char buffer[MAX_PATH];
GetModuleFileNameA(NULL, buffer, MAX_PATH );
string::size_type pos = string( buffer ).find_last_of( "\\/" );
string currentPath = string(buffer).substr( 0, pos);
CHAR fullPath[MAX_PATH];
sprintf(fullPath ,"%s\\%s" ,currentPath.c_str() ,"Demo.exe");

 

标签:string,buffer,MAX,pos,c++,获取,所在位置,currentPath,PATH
来源: https://www.cnblogs.com/nanfei/p/12071881.html