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 

Problem with command line parsing routines in FTN95

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





PostPosted: Thu Oct 21, 2004 10:52 am    Post subject: Problem with command line parsing routines in FTN95 Reply with quote

I've been using FTN77 for several months and have no problem using the CMNARGS command line parsing routine. Currently in evaluating FTN95 and now calls to CMNARGS no longer work. The short program below demonstrates the command line parsing that was working under FTN77.

I've tried it from both the command line FTN95 and from within Visual Studio (VS). In VS, the debugger shows that call to CMNARGS returns a large negative value, and so the program stops.

Not sure what the problem is. The program seems to compile and link just fine, and an EXE is produced.

Any suggestions would be greatly appreciated.

program CommandArgs
integer CMNARGS*2, argCount
character CMNAM*20, inFile*20, outFile*20

C check for correct number of command-line arguments
argCount=CMNARGS@()
if (argCount .lt. 2) then
print *, 'Usage: CommandArgs InFile OutFile'
stop
endif

C read the command-line arguments
inFile=CMNAM()
outFile=CMNAM()

C display some info
print *, 'Argument count: ', argCount
print *, 'Input file: ', inFile
print *, 'Output file: ', outFile
stop
end
Code:


Regards,
Ron
Back to top
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Mon Oct 25, 2004 1:13 pm    Post subject: Problem with command line parsing routines in FTN95 Reply with quote

Hi,

It does indeed seem there is a problem with the routines you are using. There is an alternative however and these are the F2000 intrinsics for obtaining command line arguments. Most compilers support this bit of F2000 now. I have pasted modified code below that works using the new routines:

Code:

program CommandArgs
integer argCount
character CMNAM*20, inFile*20, outFile*20

! check for correct number of command-line arguments
argCount=COMMAND_ARGUMENT_COUNT()
if (argCount .lt. 2) then
print *, 'Usage: CommandArgs InFile OutFile'
stop
endif

! read the command-line arguments, 0 is the program name
CALL GET_COMMAND_ARGUMENT(1, inFile)
CALL GET_COMMAND_ARGUMENT(2, outFile)


! display some info
print *, 'Argument count: ', argCount
print *, 'Input file: ', inFile
print *, 'Output file: ', outFile
stop
end
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