Size of path in FileCopy function ? [Resolved]

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Size of path in FileCopy function ? [Resolved]

Post by Kwai chang caine »

Hello at all

Are they a limit for the path for the instruction CopyFile ?
Because i have

Code: Select all

CopyFile(PathA+ PathB, PathC + PathB) 
And

Code: Select all

Len(PathA + PathB) = 164
Len(PathC + PathB) = 261
Apparently that work if the second parametre is "c:\Temp"

Code: Select all

CopyFile(PathA+ PathB, "C:\Temp\File.dll") 
Good day
Last edited by Kwai chang caine on Wed Sep 04, 2013 4:52 pm, edited 1 time in total.
ImageThe happiness is a road...
Not a destination
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Size of path in FileCopy function ?

Post by ts-soft »

The limit on windows (ASCII) is 260, including nullbyte!
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Size of path in FileCopy function ?

Post by Kwai chang caine »

It's the reason why

Code: Select all

Len(PathC + PathB) = 261
:oops:

Thanks a lot TsSoft 8)
ImageThe happiness is a road...
Not a destination
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Size of path in FileCopy function ? [Resolved]

Post by IdeasVacuum »

You can test it against #MAX_PATH
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Size of path in FileCopy function ? [Resolved]

Post by Kwai chang caine »

Yes i have forgotten this constant :oops:
Thanks too IdeasVacuum 8)
ImageThe happiness is a road...
Not a destination
normeus
Enthusiast
Enthusiast
Posts: 472
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: Size of path in FileCopy function ? [Resolved]

Post by normeus »

I try to use UNC most of the time:

Code: Select all

pathc = "G:\movies\there are 254 characters minus one or two\for this path\"
should look like this:

Code: Select all

pathc = "\\?\G:\movies\there are 254 characters minus one or two\for this path\"
people get really wordy with their paths at my place and UNC could go up to 32k chars

Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Size of path in FileCopy function ? [Resolved]

Post by IdeasVacuum »

...that would be long UNC or UNCW
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply