【发布时间】:2012-01-24 15:07:19
【问题描述】:
我想得到当前可执行文件的文件路径,最后没有可执行文件名。
我正在使用:
char path[1024];
uint32_t size = sizeof(path);
if (_NSGetExecutablePath(path, &size) == 0)
printf("executable path is %s\n", path);
else
printf("buffer too small; need size %u\n", size);
它可以工作,但这会在末尾添加可执行文件名称。
【问题讨论】: