|
![](/i/fill.gif) |
"Jon A. Cruz" wrote:
>
> On Windows, there's a define in an include file somewhere you should use.
> MAX_PATH. It's in stdlib.h and windef.h on my version here. In those it's set
> to 260.
Although for new work, you should use the ANSIesque _MAX_PATH . (All system thingys
are prefixed with an underscore to diferentiate from user thingys.)
From the MSDN library:
===================================================================================
Path Field Limits
#include <stdlib.h>
Remarks
These constants define the maximum length for the path and for the individual fields
within the path.
Constant Meaning
_MAX_DIR Maximum length of directory component
_MAX_DRIVE Maximum length of drive component
_MAX_EXT Maximum length of extension component
_MAX_FNAME Maximum length of filename component
_MAX_PATH Maximum length of full path
The sum of the fields should not exceed _MAX_PATH.
===================================================================================
Of course in typical M$ "We interpret the standards" fashion, we end up with
_strnicmp() yet strncmp().
> Interestingly enough, wininet has a INTERNET_MAX_PATH_LENGTH set to 2048. I
> guess all those buffer overruns attacks on MSIE were in part due to MS
> programmers not using their own defines.
Bug wise, it doesn't really matter what define you use if you ignore it yourself.
That is, if you define a 256 byte buffer and then don't care how much you put in...
---
dik
Post a reply to this message
|
![](/i/fill.gif) |