View previous topic :: View next topic |
Author |
Message |
RichardMay
Joined: 02 May 2006 Posts: 25
|
Posted: Thu Feb 01, 2007 10:36 am Post subject: get_command_argument |
|
|
I have been experimenting with long arguments.
The small program below reads an argument and prints it.
program argtest
character*160 carg
call get_command_argument(1,carg,larg)
write(*,1001)carg
1001 format(a160)
stop
end
When I run it with an argument of length 150 I get the following
1abcdefghijklmnopqrstuvwx2abcdefghijklmnopqrstuvwx3abcdefghijklmnopqrstuvwx
4abcdefghijklmnopqrstuvwx5abcdefghijklmnopqrstuvwx6abcdefghijklmnopqrstuvwx
When the argument is enclosed in " ", as it would be if it had spaces, the output is truncated
1abcdefghijklmnopqrstuvwx2abcdefghijklmnopqrstuvwx3abcdefghijklmnopqrstuvwx
4abcdefghijklmnopqrstuvwx5abcdefghijklmnopqrstuvwx6ab |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Fri Feb 02, 2007 12:25 am Post subject: |
|
|
Richard,
Have a look at the value of larg. I got 128 and 126 for your 2 cases. It may be that 128 is a limit, although without " ", the extra characters are also returned.
program argtest
character*160 carg
integer*4 larg, status, nchar
call get_command_argument (1,carg,larg,status)
write(*,1001)carg
nchar = len_trim (carg)
write (*,*) 'found = ',larg
write (*,*) 'status = ',status
write (*,*) 'returned = ', nchar
1001 format(a)
stop
end |
|
Back to top |
|
|
RichardMay
Joined: 02 May 2006 Posts: 25
|
Posted: Fri Feb 02, 2007 9:48 am Post subject: |
|
|
John,
Yes, I know. I think that 128 is a limit, but the real question is, is this correct Fortran 2003 or a FTN95 bug? Does this mean that in order to parse a command line which has a long argument with spaces, surrounded by " ", I have to write my own routine?
Richard |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Fri Feb 02, 2007 1:54 pm Post subject: |
|
|
Yes there is an internal limit of 128 characters.
It would be trivial increase this, non-trivial to make it open-ended.
Would 256 be enough? |
|
Back to top |
|
|
RichardMay
Joined: 02 May 2006 Posts: 25
|
Posted: Fri Feb 02, 2007 2:34 pm Post subject: |
|
|
Paul,
I imagine 256 should be enough. Long arguments are needed when our clients run our software in very "deep" project directories. It's quite easy to get past 100 characters, but 200 is really really long. We should really be consistent with Windows, but I have no idea what that entails.
Richard |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Fri Feb 02, 2007 6:09 pm Post subject: |
|
|
If you want to send me your email address (as a private message) then I will send you a new salflibc.dll when the change has been made. |
|
Back to top |
|
|
RichardMay
Joined: 02 May 2006 Posts: 25
|
Posted: Tue Feb 20, 2007 12:47 pm Post subject: |
|
|
Paul,
Did you get my private message with my email address? When do you expect to have a new salflibc.dll available?
Richard |
|
Back to top |
|
|
RichardMay
Joined: 02 May 2006 Posts: 25
|
Posted: Tue Feb 20, 2007 2:35 pm Post subject: |
|
|
Paul,
Got it, thanks.
Richard |
|
Back to top |
|
|
RichardMay
Joined: 02 May 2006 Posts: 25
|
Posted: Tue Feb 27, 2007 11:42 am Post subject: |
|
|
Paul,
Although the test program above now prints out the full 150 character argument, in the debugger the full argument is not available and larg is still 126. Unfortunately this means that I cannot easily debug my main program.
Richard |
|
Back to top |
|
|
|