EVC implements file traversal and search

Source: Internet
Author: User

EVC implements file traversal and search

Author: Peng xuezhou (favory. Peng)

We can use the cfilefind class to find files in vc6.0, but this class is not available in EVC;

In EVC, we can use the findfirstfile and findnextfile provided by the system API to find the files in the folder and find the files we need;

Instance code:

  1. // Function: Find the INI file of the Language Pack
  2. Win32_find_data lpfindfiledata;
  3. Handle hfile = invalid_handle_value;
  4. Bool bfound = false;
  5. Cstring szvalue = l "";
  6. Cstring szfilepath = l "";
  7. Hfile = findfirstfile (g_szcurpath + L "language // *. ini", & lpfindfiledata );
  8. If (hfile! = Invalid_handle_value)
  9. {
  10. Do
  11. {
  12. Szfilepath = g_szcurpath + L "language //" + lpfindfiledata. cfilename;
  13. If (szvalue = cprofile: getprofilestring (szsection, szkey, l "", szfilepath ))! = L "")
  14. {
  15. If (szvalue = szlang)
  16. {
  17. G_sz1_agepath = szfilepath;
  18. Bfound = true;
  19. Break;
  20. }
  21. }
  22. } While (findnextfile (hfile, & lpfindfiledata ));
  23. }
  24. Findclose (hfile );

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.