There is currently 1 post.
Font size: Small - 100% (Default)  Content converter: No conversion
 
Clicks Replies
1056 0
【方法】在指定文件夹中搜索文件
巨大八爪鱼
武林盟主 二十一级
Reply
Floor 1 Posted at: 3/25/16 21:40
【程序】
#include "stdafx.h"
#include <Windows.h>

#define echo(str) WriteConsole(hConsoleOutput, str, _tcslen(str), NULL, NULL)
#define echo_t(str) echo(TEXT(str))

int _tmain(int argc, _TCHAR* argv[])
{
    LPTSTR szFileName = TEXT("D:\\Codes\\PHP\\Arslanbar\\2\\classes\\*t.*");
    WIN32_FIND_DATA ffd;
    HANDLE hFindFile = FindFirstFile(szFileName, &ffd);
    HANDLE hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    if (hFindFile == INVALID_HANDLE_VALUE)
    {
        echo_t("No file");
    }
    else
    {
        do
        {
            echo(ffd.cFileName);
            echo_t("\r\n");
        } while (FindNextFile(hFindFile, &ffd));
        FindClose(hFindFile);
    }
    return 0;
}

【输出】
DataObject.php
DataObject.php.LCK
Request.php
ZhSupport.php
Press any key to continue . . .
Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
(Shortcut key: Ctrl+Enter)
Post Information
Clicks: 1056 Replies: 0
Author: 巨大八爪鱼
Last reply: 巨大八爪鱼
Last reply time: 3/26/16 10:18
Bar Good Posts
Announcements