码迷,mamicode.com
首页 > 其他好文 > 详细

c函数 文件名通配符

时间:2018-04-20 12:17:39      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:r++   ==   har   amp   match   bsp   col   static   文件   

 1 static bool IsMatched(CONST TCHAR* p, CONST TCHAR* q)
 2 {
 3     CONST TCHAR *r, *z, *x = _T("");
 4     for (r = p; *p; ++p)
 5         if (*p == ‘\\‘)
 6             r = p + 1;
 7         else if (*p == ‘.‘)
 8             x = p;
 9     z = r;
10     while (*q)
11     {
12         while (*q == ‘|‘)q++;
13         if (*q == ‘*‘)
14         {
15             r = x;
16             while (*++q != ‘.‘ && *q);
17         }
18         while (tolower(*q) == tolower(*r) && *r) r++, q++;
19         if (*q == ‘*‘ || !*r && (!*q || *q == ‘|‘))
20         {
21             return true;
22         }
23         while (*q != ‘|‘ && *q)++q;
24         r = z;
25     }
26     return false;
27 }

 

c函数 文件名通配符

标签:r++   ==   har   amp   match   bsp   col   static   文件   

原文地址:https://www.cnblogs.com/xuyouzhu/p/8889611.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!