PathRemoveFileSpec函数

标签: ,

PathRemoveFileSpec函数的作用是将路径末尾的文件名和反斜杠去掉。

例如,我们想获取EXE文件自身所在的文件夹,可以这样写:

#include <stdio.h>
#include <Shlwapi.h>

int main(int argc, char *argv[])
{
    char self[MAX_PATH];

    GetModuleFileName(NULL, self, MAX_PATH);
    PathRemoveFileSpec(self);
    printf("%s\n", self);

    return 0;
}

参考链接:http://msdn.microsoft.com/en-us/library/windows/desktop/bb773748%28v=vs.85%29.aspx

赞赏

微信赞赏支付宝赞赏

随机文章:

  1. MySQL的Unicode支持
  2. Zen Coding for EditPlus
  3. VBS也玩验证码识别
  4. PHP中的gzcompress gzdeflate gzencode函数
  5. 未能正确加载“Microsoft.VisualStudio.Editor.Implementation.EditorPackage”包

留下回复