Re: MAX_PATH
- From: Tamas Demjen <tdemjen@xxxxxxxxx>
- Date: Fri, 09 Mar 2007 12:01:15 -0800
Tracey wrote:
I remember perusing some files somewhere and saw something like:
if (os_ver >= some_num) ...
if (ie_ver >= some_num) ...
I wasn't sure if I had to test per version to find the MAX_PATH or if all
Windows OSs are the same.
In Win32, MAX_PATH is always 260. You should always be OK with code like this:
TCHAR path[MAX_PATH];
GetTempPath(MAX_PATH, path);
The NTFS file system in modern versions of Windows (such as XP and Vista) can handle file paths with up to 32,000 characters. The Unicode version of some of the system functions support such long paths, using a special \\?\ prefix. You may not be able to browse such a deep directory structure with Windows Explorer, and a lot of the API functions won't be able to handle such long paths. This doesn't affect MAX_PATH in any way. MAX_PATH is the shell's limit. 32,000 is the file system's limit. They're two different things.
Unless you're doing something extreme, you should be fine with MAX_PATH. I wouldn't recommend exceeding this limit, unless you have a very good reason. If you have to ask, assume that is the limit. MAX_PATH includes the terminating \0, so the actual number of useful characters in a file path is 1 less. So if you have to store the longest possible file path in a database, that's VARCHAR(259).
Tom
.
- References:
- MAX_PATH
- From: Tracey
- Re: MAX_PATH
- From: Igor Tandetnik
- Re: MAX_PATH
- From: Tracey
- MAX_PATH
- Prev by Date: Re: Whats going onto the stack here?
- Next by Date: Re: alloca / _alloca / dynamic stack memory
- Previous by thread: Re: MAX_PATH
- Next by thread: Re: MAX_PATH
- Index(es):
Relevant Pages
|