Path Field Limits

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Path Field Limits.

Syntax

#include <stdlib.h>  

These constants define the maximum length for the path and for the individual fields within the path.

ConstantMeaning
_MAX_DIRMaximum length of directory component
_MAX_DRIVEMaximum length of drive component
_MAX_EXTMaximum length of extension component
_MAX_FNAMEMaximum length of filename component
_MAX_PATHMaximum length of full path
System_CAPS_ICON_note.jpg Note

The C Runtime supports path lengths up to 32768 characters in length, but it is up to the operating system, specifically the file system, to support these longer paths. The sum of the fields should not exceed _MAX_PATH for full backwards compatibility with FAT32 file systems. Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Server 2003, and Windows Vista NTFS file system supports paths up to 32768 characters in length, but only when using the Unicode APIs. When using long path names, prefix the path with the characters \\?\ and use the Unicode versions of the C Runtime functions.

Global Constants

Show: