Advertisement

files and directories

Started by September 06, 2000 11:26 AM
5 comments, last by braves 24 years, 4 months ago
what''s the longest a file can be in Windows9x and NT? What is also the longest a directory and directory path can be in Win9x and NT. braves
Longest filename (according to the help files) is 255...
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Advertisement
longest file name: 255
Longest path: 259

Look in stdlib.h for all the values.

"things are more like they are now than they ever have been"
"It's obvious isn't it Miller? Curiosity killed these cats!"
It depends on the filesystem you use.

I don''t know the numbers but NTFS can handle much longer filenames than FAT32
I think a file-length can be 256 max (including ''\0'')
The path length is defined by MAX_PATH.

I always use MAX_PATH for both filenames & path...

Ok, I looked in stdlib.h and I found this :

#ifndef _MAC
#define _MAX_PATH 260 /* max. length of full pathname */
#define _MAX_DRIVE 3 /* max. length of drive component */
#define _MAX_DIR 256 /* max. length of path component */
#define _MAX_FNAME 256 /* max. length of file name component */
#define _MAX_EXT 256 /* max. length of extension component */
#else /* def _MAC */
#define _MAX_PATH 256 /* max. length of full pathname */
#define _MAX_DIR 32 /* max. length of path component */
#define _MAX_FNAME 64 /* max. length of file name component */
#endif /* _MAC */

now...when it has _MAX_PATH, is this just the path or path and filename? and it says if _MAC is defined, _MAX_PATH is 260 but if it''s not 256. Should I define _MAC and what''s the difference between the _MAC defined and not defined?
Braves

Advertisement
_MAC: Macintosh -

Max_Path is the whole path name including the drive letter specification. The numbers include the null terminator so you really get to use one less. The other numbers are the maximum for that component of the path name. e.g. if your filename by itself is 255, you don''t have enough room left to use anything else except the drive letter designation.
"It's obvious isn't it Miller? Curiosity killed these cats!"

This topic is closed to new replies.

Advertisement