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:
- // Function: Find the INI file of the Language Pack
- Win32_find_data lpfindfiledata;
- Handle hfile = invalid_handle_value;
- Bool bfound = false;
- Cstring szvalue = l "";
- Cstring szfilepath = l "";
- Hfile = findfirstfile (g_szcurpath + L "language // *. ini", & lpfindfiledata );
- If (hfile! = Invalid_handle_value)
- {
- Do
- {
- Szfilepath = g_szcurpath + L "language //" + lpfindfiledata. cfilename;
- If (szvalue = cprofile: getprofilestring (szsection, szkey, l "", szfilepath ))! = L "")
- {
- If (szvalue = szlang)
- {
- G_sz1_agepath = szfilepath;
- Bfound = true;
- Break;
- }
- }
- } While (findnextfile (hfile, & lpfindfiledata ));
- }
- Findclose (hfile );