Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以找到 .jpg 文件 但是我怎样才能找到 .jpg、.bmp、.png .... 文件?
面具
LPWSTR mask = stoL(path + "*.(jpg)");
处理程序初始化
HANDLE hf = FindFirstFile(mask, &FindFileData);
字符串到 LPWSTR
LPWSTR stoL(string s) { return CA2T(s.c_str()); }
如果您想查找多个扩展名,您有两种选择:您可以单独搜索您关心的每个扩展名,或者您可以对所有文件进行一次搜索,然后查看每个文件是否适合您关心的扩展名之一。
像*.(jpg|png|bmp)just 一样的东西是行不通的——FindFirstFile并且FindNextFile无法识别(,|或),因此在这种模式下,它将搜索单个扩展名——即所有以字符(jpg|png|bmp)作为扩展名的文件(这将当然,通常会失败)。
*.(jpg|png|bmp)
FindFirstFile
FindNextFile
(
|
)
(jpg|png|bmp)