点击查看详细介绍

根据一段路径,循环判断文件夹是否存在,不存在依次创建

nxopen 5年前 1731 6

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


//根据一段路径,循环判断文件夹是否存在,不存在依次创建
int HuFuns::HuBase::CreatFullFolder(string strFilePath) 
{
    int err=0;

    string fileName = strFilePath.substr(strFilePath.find_last_of("\\")+1, strFilePath.length()-(strFilePath.find_last_of("\\")+1));
    if (fileName!="")
    {
        if (strFilePath.find(".") == std::string::npos)
        {
            strFilePath=strFilePath+"\\";
        }
    }

    //开始分割
    if (true)
    {
        string pattern="\\";
        size_t pos = strFilePath.find(pattern);
        size_t size = strFilePath.size();

        string tPath="";
        while (pos != std::string::npos)
        {

●●●请先 登陆注册 后查看●●●

            strFilePath = strFilePath.substr(pos + pattern.length(), size);
            pos = strFilePath.find(pattern);
        }
    }


    return err;
}


0

最新回复 (6)
  • 熊武强 VIP会员 5年前
    1

    楼主辛苦,学习一下

  • allspark 5年前
    2

    楼主威武 正在学习 好资料 谢谢分享

  • zxj_sz 4年前
    3

    学习学习了解一下

  • 模具 VIP会员 4年前
    4

    学习学习了解一下

  • 王牌飞行员 VIP会员 4年前
    5

    谢谢分享 ,学习一下

  • a970356240 VIP会员 1月前
    6

    谢谢分享 ,学习一下

请登录后发表新帖