Windows API recursively traverses all files under folder

Source: Internet
Author: User

1. There are some code problems on the Internet, improve the following

#include <stdio.h> #include <windows.h> #include <iostream> #include <string>using namespace Std;int count = 0;void Find (char * lppath) {char Save_path[200];char Szfile[max_path] = {0};char Szfind[max_path];char root [MAX_PATH]; Win32_find_data findfiledata;strcpy (Szfind,lppath); Strcat (Szfind, "* *"); HANDLE Hfind=::findfirstfile (Szfind,&findfiledata); if (Invalid_handle_value = = hfind) return;while (TRUE) {if ( Findfiledata.dwfileattributes & File_attribute_directory) {if (findfiledata.cfilename[0]!= '. ') {strcpy (Szfile,lppath);//strcat (Szfile, "//"); strcat (szfile,findfiledata.cfilename); Strcat (Szfile, "//"); Find ( szfile);}} else{strcpy (Root, Lppath); strcat (root,findfiledata.cfilename); cout << root << endl;} if (! FindNextFile (Hfind,&findfiledata)) break; FindClose (hfind);} void Main () {Find ("... 2003//");}


Windows API recursively traverses all files under Folders

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.