GetFullPathName

  DWORD GetFullPathName(lpszFile, cchPath, lpszPath, ppszFilePart)    
  LPCTSTR lpszFile; /* name of file to find path for */
  DWORD cchPath; /* size of path buffer in characters */
  LPTSTR lpszPath; /* address of path buffer */
  LPTSTR *ppszFilePart; /* pointer to file name in path */

The GetFullPathName function retrieves the full pathname for the specified file.

Parameters

lpszFile

Points to a null-terminated file name.

cchPath

Specifies the size of the buffer (in characters) for the full pathname.

lpszPath

Points to a buffer for the full pathname.

ppszFilePart

Points to a variable that receives the address (in lpszPath) of the final component in the pathname.

Return Value

If the function is successful, the return value is the length (in characters) of the string copied to lpszPath, not including the terminating null character.

If the lpszPath buffer is too small, the return value is the size of the buffer required to hold the pathname.

If the function fails, the return value is zero. Use the GetLastError function to obtain extended error information.

Comment

This function is used to return a fully qualified pathname corresponding to the specified filename. It does this by merging the current drive and directory with the specified file name. It also calculates the address of the file name portion of the fully qualified pathname. This function does not verify that the resulting pathname refers to an existing file or is otherwise a valid filename on the associated volume.

The GetFullPathName function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

See Also

SearchPath, GetTempPath