Platform SDK: Files and I/O |
The GetFullPathName function retrieves the full path and file name of a specified file.
DWORD GetFullPathName( LPCTSTR lpFileName, // file name DWORD nBufferLength, // size of path buffer LPTSTR lpBuffer, // path buffer LPTSTR *lpFilePart // address of file name in path );
If the GetFullPathName function succeeds, the return value is the length, in TCHARs, of the string copied to lpBuffer, not including the terminating null character.
If the lpBuffer buffer is too small, the return value is the size of the buffer, in TCHARs, required to hold the path.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
GetFullPathName merges the name of the current drive and directory with the specified file name to determine the full path and file name of the specified file. It also calculates the address of the file name portion of the full path and file name. This function does not verify that the resulting path and file name are valid or that they refer to an existing file on the associated volume.
GetFullPathName does no conversion of the specified file name, lpFileName. If the specified file name exists, you can use GetLongPathName and GetShortPathName to convert to long and short path names, respectively.
MAPI: For more information, see Syntax and Limitations for Win32 Functions Useful in MAPI Development.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.
File I/O Overview, File I/O Functions, GetLongPathName, GetShortPathName, GetTempPath, SearchPath