该方法不具移植性,在Linux可使用。它指向程序文件,而不是程序文件绝对/相对路径。
#include <cstdio> extern const char* __progname; int main() { printf("%s\n",__progname); return 0; }
##参考