Hi, Pros!
I need to write to a file a full path of that file. But how long path may be.
I'm asking because I need to know maximum size which path takes in order
properly structure the innards of the file.
Printable View
Hi, Pros!
I need to write to a file a full path of that file. But how long path may be.
I'm asking because I need to know maximum size which path takes in order
properly structure the innards of the file.
use MAX_PATH ( it's a #define in windows header file )
Which is 260 characters.Quote:
Originally Posted by kirants
-Greg Dolley
There is a problem. Imagine you have a file which is very deeply in directory
tree. You can place a file as deep as you wish. Yes? Ok. If you can
bury a file so deep then it's path grew very long, isn't it. If so my path will
be more then 260 characters long? Or maybe I miss something?
As you say, If you can. So, question is, have you been successful in doing it?Quote:
Originally Posted by sulacco
Well, if the Windows API won't support paths longer then 260 characters (MAX_PATH), I would think that this is not an issue (since you can't do it).Quote:
There is a problem. Imagine you have a file which is very deeply in directory tree. You can place a file as deep as you wish. Yes? Ok. If you can
bury a file so deep then it's path grew very long, isn't it. If so my path will
be more then 260 characters long? Or maybe I miss something?
Viggy
Ok. I will check it right now....wait...
I think this is possible to do, but you have to really want to do it.
First create a very deep directory structure.
Then using a utility like junction from Sysinternals create a symbolic link to the deepest directory.
Then accessing this directory from the symbolic link continuing creating your deep directory structure.
In the end you should end up with a directory path that is longer than 260 characters.
To access that directory I think you have to preappend the path with
\\\\?\\
so something like \\\\?\\c:\\...your really long path here\\mytextfile.txt
HTH
One filename (e.g. myfile.txt) can have a maximal length of 255 unicode character under NTFS. Although the complete path name can have a maximum length of 32,767 unicode characters. See this for info and comparison.