char tBuf[1024] = {0}; int ret = readlink("/proc/self/exe" , tBuf , 1023) ; char *p = strrchr(tBuf , '/'); printf("%s\n", ++p);