19 on the 7th floor. Copy all the files in one folder to another directory.
// # Include
Using STD: string;
Char Sep = '/';
# Ifdef _ Win32
SEP = '\';
# Endif
Cfilefind finder;
Cstring path;
Path. Format ("% s \ *. *", % 1 );
Bool bworking = finder. findfile (PATH );
While (bworking)
{
Bworking = finder. findnextfile ();
If (! Finder. isdirectory () | finder. isdots ()){
String S (finder. getfilename ());
Cstring sourcefile (% 1 );
If (S. rfind (SEP, S. Length ())! = String: NPOs)
{
Sourcefile = sourcefile + "//" + S. substr (I + 1, S. Length ()-I );
Cstring targetfile (S. substr (I + 1, S. Length ()-I ));
Targetfile = % 2 + "//" + targetfile /;
Copyfile (sourcefile. getbuffer (0), targetfile. getbuffer (0), true );
}
}
}
20. Extract Extension
Cstring path (% 1 );
Cstring % 2 = path. mid (path. reversefind ('.'));
21. Extract file name
Cstring path (% 1 );
Cstring % 2 = path. mid (path. reversefind ('\') + 1 );
22. Extract the file path
Char appname [max_path];
Getmodualfilename (null, appname, max_path );
// # Include
Using STD: string;
String S (% 1 );
String newext (% 2 );
String: size_type I = S. rfind ('.', S. Length ());
If (I! = String: NPOs)
S. Replace (I + 1, newext. Length (), newext );
Cstring % 3 (s );
33. Read INI file attributes cstdiofile INIFILE (% 1, cfile: moderead); cstring Path = INIFILE. getfilepath (); INIFILE.