Page 1 of 1
ProgramParameter(), max length
Posted: Tue Apr 22, 2008 7:34 am
by horst
When a command parameter has the length of #MAX_PATH (i.e. 259 bytes plus zero-byte) and is enclosed in quote marks, it will be mutilated. Up to 257 bytes is ok.
Maybe the PB internal buffer that receives the command parameter is not large enough to hold the extra quote marks ???
Posted: Tue Apr 22, 2008 9:31 am
by maw
Ehh? MAX_PATH is 255 chars + ending zero...
Posted: Tue Apr 22, 2008 9:46 am
by ts-soft
maw wrote:Ehh? MAX_PATH is 255 chars + ending zero...
Posted: Tue Apr 22, 2008 12:13 pm
by maw
Damn.. I could have sworn that MAX_PATH was defined as 256.. Oh well, never mind me then

Posted: Tue Apr 22, 2008 3:42 pm
by Trond
It should still be possible to use parameters longer than MAX_PATH.
Posted: Tue Apr 22, 2008 3:56 pm
by horst
Trond wrote:It should still be possible to use parameters longer than MAX_PATH.
That's a different request.
I just want to use a path parameter with a length up to MAX_PATH (not including the quote marks).
Posted: Thu Jun 12, 2008 3:36 pm
by Fred
I just tried, but can't see the limit. Can anyone else confirm ?
Code: Select all
openconsole()
a$ = programparameter()
printn(a$)
input()
and paste this as program parameter:
Code: Select all
";11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111aaaaa"
Posted: Thu Jun 12, 2008 3:48 pm
by Blue
Fred wrote:I just tried, but can't see the limit. Can anyone else confirm ?
Confirmed under Vista SP1.
The test works with your 329-char long argument...
No limit.
BTW: returns 260 !
Posted: Thu Jun 12, 2008 4:13 pm
by horst
Fred wrote:I just tried, but can't see the limit. Can anyone else confirm ?
I am sorry, I just tested again, and found it is a limitation of the Windows shortcut: The Target cannot be longer than #max_path, including the program path
and all parameters. This also applies, when you drag&drop a long file name on a shortcut.
PB seems to handle it correctly.
Sorry
Posted: Thu Jun 12, 2008 4:16 pm
by Fred
No problem, interesting to know, will move it to 'Windows' forums.