Jay
Jay

Reputation: 24895

Alternative for windows fullpath API which can take path greater than 255 characters!

_fullpath API of windows takes relative path and gives the corresponding absolute path. But, it fails if the relative path is greater than 255 characters.

Is there any other API available in Windows which can convert the relative path to absolute path and doesn't have the problem mentioned above?

Upvotes: 1

Views: 555

Answers (2)

Joey
Joey

Reputation: 354356

I think the closest equivalent would be the GetFullPathName function. You can explicitly call the Unicode version of it and prepend \\?\ to the path to allow for more than MAX_PATH characters.

Upvotes: 2

dirkgently
dirkgently

Reputation: 111120

I think this is a limitation of the particular version of the OS. Look up this article on MSDN.

To resolve problems when the directory structure exceeds MAX_PATH, use either of the following methods:

On the server that contains the long directory structure, access these files and folders through a local redirection ("net use" or "subst") of the same share/folder that the network clients access across the network.

In Windows NT Explorer, select the folder one level above the folder that returns the error. Right-click the folder returning the error and then click Rename. Rename the folder to reduce the number of characters used in the folder name.

Read this MSDN page as well on max path length restrictions.

Another interesting read on the Joel on Software Discussion Group.

Upvotes: 1

Related Questions