zoukankan      html  css  js  c++  java
  • Windows下_findnext()异常问题

    _findnext()在调试时会出现异常现象,第一个参数”路径句柄”,返回的类型为intptr_t(long long),要改为long long或者intptr_t

    //path 目录   filelist 文件列表   mode 文件名中的关键字
    void filesearch(string path, vector<string>& filelist, string mode) 
    {
      struct _finddata_t filefind;
      if (path[path.size() - 1] == '\') 
          path.resize(path.size() - 1);
      string curr = path + "\*.*";
      int done = 0;
      intptr_t handle = 0;
      if ((handle = _findfirst(curr.c_str(), &filefind)) == -1) 
          return;
      while (!(done = _findnext(handle, &filefind))) 
      {
        if (!strcmp(filefind.name, "..")) 
            continue;
        curr = path + "\" + filefind.name;
        if (_A_SUBDIR == filefind.attrib) 
            filesearch(curr, filelist, mode);
        if (strstr(filefind.name, mode.c_str())) 
            filelist.push_back(curr);
    
      }
      _findclose(handle);
    }
    
  • 相关阅读:
    正则表达式(验证账号密码邮箱身份证)
    JS Fetch
    事件流动
    JS DOM和BOM
    CSS的定位
    For each...in / For...in / For...of 的解释和例子
    CSS的gridlayout
    CSS position属性
    CSS的颜色
    twelfth week
  • 原文地址:https://www.cnblogs.com/chencarl/p/14892464.html
Copyright © 2011-2022 走看看