So we all know that Windows programs by default are limited to dealing
with a maximum path length of 260 characters. However, this limit can easily be overcome by prefixing the path by the \\?\
character sequence.
For some reason, however, this isn't possible with relative paths, as MSDN says:
Because you cannot use the
\\?\
prefix with a relative path, relative paths are always limited to a total ofMAX_PATH
characters.
(source)
I don't really understand the reason why Microsoft decided to forbid relative paths to be prefixed with \\?\
so if there is some sort of rationale behind this decision, I'd be really glad to hear about it because it doesn't really make sense to me that \\?\
is only allowed for full paths.
My real question, though, is how to deal with this limitation: Should I simply call GetFullPathName()
on relative paths to extend them to full paths, then add the \\?\
prefix, and then pass that path to fopen()
etc., or what is the recommended way of dealing with this limitation?