从argv中解析出进程名称
#include <iostream>#include <string>#ifdef WIN32#define PATH_SEP "\"#else#define PATH_SEP "/"#endifint test(int argc, char *argv[]){ std::cout << argv[0] << std::endl; std::string strProcName = argv[0]; std::string::size_type pos1 = strProcName.find_last_of(PATH_SEP); if (pos1 != std::string::npos) { strProcName = strProcName.substr(pos1+1); } std::cout << strProcName << std::endl; pos1 = strProcName.find(".exe"); if (std::string::npos != pos1) { strProcName = strProcName.substr(0, pos1); } std::cout << strProcName << std::endl; return 0;}