forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

get_command_argument

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
RichardMay



Joined: 02 May 2006
Posts: 25

PostPosted: Thu Feb 01, 2007 10:36 am    Post subject: get_command_argument Reply with quote

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
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Fri Feb 02, 2007 12:25 am    Post subject: Reply with quote

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
View user's profile Send private message
RichardMay



Joined: 02 May 2006
Posts: 25

PostPosted: Fri Feb 02, 2007 9:48 am    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7925
Location: Salford, UK

PostPosted: Fri Feb 02, 2007 1:54 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
RichardMay



Joined: 02 May 2006
Posts: 25

PostPosted: Fri Feb 02, 2007 2:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7925
Location: Salford, UK

PostPosted: Fri Feb 02, 2007 6:09 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
RichardMay



Joined: 02 May 2006
Posts: 25

PostPosted: Tue Feb 20, 2007 12:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
RichardMay



Joined: 02 May 2006
Posts: 25

PostPosted: Tue Feb 20, 2007 2:35 pm    Post subject: Reply with quote

Paul,

Got it, thanks.

Richard
Back to top
View user's profile Send private message
RichardMay



Joined: 02 May 2006
Posts: 25

PostPosted: Tue Feb 27, 2007 11:42 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group