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_P...

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");

 

本文标题为:c++获取当前进程所在位置

基础教程推荐