I see looking at the long path path in my windows application.
Currently, I have a text box (edit box) in which the user can write an absolute file path. I have written that the file paths typed using GetWindowText , such as the string has been announced: TCHAR FilePath [MAX_PATH];
Obviously, here I am dependent on 'I MAX_PATH which limits me to 260 characters so that I can handle more file / path names TCHAR FilePath [32767]; .
Or is there any better way? Can I use a variable length array? ( TCHAR FilePath []; Is this also possible in C ++? - Sorry, I'm very new to this).
Thank you! In Advanced!
Here is the complete code snippet of what I have mentioned above:
TCHAR filepath [MAX_PATH]; Zoramory (& amp; file path, shape (file palette)); GetWindowText (hWndFilePath, file path, MAX_PATH); There are many limitations regarding file paths on Windows By default, path 260 characters Can not be longer than that, which is constant MAX_PATH . However, you can access more paths - with some limitations - by prefixing the path with "\\? \" However, the "\\? \" Prefix Limitations to use are usually equivalent to profit:
- There are several Win32 APIs that do not support a support path with this prefix (for example,
LoadLibrary Will always fail on the path longer than 260 characters) - The Win32 Canonicalization rules are not effective when using the "\\? \" Prefix? For example, by default, "/" in paths "\", "." And ".." are referred to in the current and root directories respectively, and so on: when you use the "\\ ?," prefix, then there is no such thing.
- Just because you can your program to support more paths, other programs may fail to open the files you created. This would be the case if those other Programs also do not use the "\\? \" Prefix.
To be honest, point # 2 real killer: You can open yourself up to all kinds of problems while using the "\\? \" Prefix and if you use that path If you go on, you'll basically have to implement the Win32 canonicalization rule again.
Therefore, my recommendation is to stay with the 260 limit at least until the better route is not supported for the long route.
Comments
Post a Comment