Header file: shlwapi. h
Bool pathfileexists (lpctstr lpszpath)
Function: Check whether the file/path exists.
Lptstr pathfindfilename (lpctstr ppath)
Function: get the file name in the path.
For example, pathfilefilename ("C: // program files // file.txt") = program file.txt ".
If the path does not contain a file name, the returned value is the lowest directory name.
Lptstr pathfindextension (lpctstr ppath)
Function: gets the file extension in a path or file name.
Example: pathfindextension (file.txt ") = pai.txt"
Lptstr pathfindnextcomponent (lpctstr pszpath)
For example, pathfindnextcomponent ("C: // program files // Directory") = "Program Files // Directory"
Pathfindnextcomponent ("C: // program files") = "Program Files"
Bool pathfindonpath (in out lptstr pszfile, in lpctstr * ppszotherdirs)
Function: Search for files in a specified directory.
Parameter: the name of the pszfile file to be searched. Make sure that the pszfile size is sufficient to accommodate max_path characters. If the specified file can be found, this parameter returns the full path of the file.
Ppszotherdirs this parameter is the list of directories to be searched for first. It can be null. If it is null, the function will look for it in the system directory, current directory, and directory set by path.
Lptstr pathgetargs (lpctstr pszpath)
Function: Analyze parameters from the path.
For example: lptstr pszparam = pathgetargs (using notepad.exe C: // temp.txt ")
Pszparam returns "C: // temp.txt"
Int pathgetdrivenumber (lpctstr lpsz)
Function: analyzes the drive letter from the path.
Return Value: 0-25 is returned for success, indicating (a-z).-1 is returned for failure.
Bool pathiscontenttype (maid, maid)
Function: checks whether the object is of the specified contenttype.
For example, pathiscontenttype (“hello.txt "," text/plain ") returns true.
Pathiscontenttype (“hello.txt "," image/GIF ") returns false
Bool pathisdirectory (lpctstr pszpath)
Function: Check whether the path is a valid directory. Note: The path cannot contain the file name.
Bool pathisfilespec (lpctstr lpszpath)
Function: Check whether the path contains the ':' and '/' delimiters.
Bool pathishtmlfile (lpctstr pszfile)
Function: Check whether the file is an HTML file.
Bool pathisprefix (in maid, In maid)
Function: Check whether the path contains the specified prefix. The prefix is "drive letter: //", ".. //", and ". //".
Pathisprefix ("C: //", "c: // hello.txt") returns true
Bool pathisrelative (lpctstr lpszpath)
Function: Check whether the path is relative.
Bool pathisroot (lpctstr ppath)
Function: Check whether the path is the root directory.
Bool pathissameroot (maid, maid );
Function: Compares whether two paths are on the same drive letter.
Bool pathisunc (lpctstr pszpath );
Function: determines whether the path is in UNC format.
Bool pathisurl (in lpctstr pszpath );
Function: determines whether the path is a URL.
Bool pathmatchspec (maid, maid)
Function: Use a wildcard (* and? To compare another string.
Example: pathmatchspec ("http://news.sina.com.cn", "* Sina.com *") returns true
Pathmatchspec ("C: // hello.txt", "*. txt") returns true
Void pathremoveargs (lptstr pszpath );
Function: delete parameters contained in a path.
Lptstr pathremovebackslash (lptstr lpszpath );
Function: Delete unnecessary '/' characters at the end of a path.
Void pathremoveblanks (lptstr lpszstring );
Function: deletes spaces at the beginning and end of a string.
Void pathremoveextension (lptstr pszpath );
Function: delete the file extension following the path.
Bool pathremovefilespec (lptstr pszpath );
Function: delete the file name and '/' symbol after the path. This function can analyze the path of a file.
For example, szpath = "C: // windows // system32 // nt. dll ";
After pathremovefilespec (szpath) is called, szpath = "C: // windows // System32"
Bool pathrenameextension (in out lptstr pszpath, lpctstr pszext );
Function: Replace the file extension after the path. If pszpath does not have an extension, the new extension will be added.
Pszpath must contain at least max_path characters.
New pszext extension, must contain.
Void pathstrippath (lptstr pszpath );
Function: extract file names from the path
Example: pathstrippath ("C: // test // hello.txt") => hello.txt
Bool pathstriptoroot (lptstr srorot );
Function: analyzes the drive letter from the path.
Void pathunquotespaces (lptstr lpsz );
Function: extracts a path from a path with quotation marks.
Example: szpath = "/" C: // program files /""
Pathunquotespaces (szpath) => szpath = "C: // Program Files"
A path-related function is provided by imagehlp.
Bool searchtreeforfile (
In lpstr rootpath,
In lpstr inputpathname,
Out lpstr outputpathbuffer
);
Function: searches for files in the specified directory tree.