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");
原文:https://www.cnblogs.com/nanfei/p/12071881.html