是否有Linux等效的Win32 API _splitpath函数?
细节:
void _splitpath (
const char *path, // Path Input
char *drive, // Drive : Output
char *dir, // Directory : Output
char *fname, // Filename : Output
char *ext // Extension : Output
);
Run Code Online (Sandbox Code Playgroud)
它将完整路径作为输入,并将驱动器,目录,文件名和扩展名作为输出.
在 C 程序中,我有一个字符串形式的文件路径(具体来说,这是exe存储在 中的名称argv[0])。我想使用 MS Visual Studio 2005 提取文件名并放弃目录路径。有任何内置函数吗?