Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

problem with GETARG

billaustralia
Beginner
517 Views
In debug environment only two args are returned from the command line
t.exe "3""4" "5" 6 "7"
They are
t.exe
3"4 5 6 7

now I would expect 5 arguments to be returned, namely
t.ext
3"4
5
6
7

Is this an error in GETARG?
Fortran is
program t
parameter (ia=15)
character args(-2:ia)*20
integer*2 i,j
print *,'iargc,nargc',iargc(),nargs()
do 100 i=-2,ia
call getarg(i,args(i),j)
print *,i,args(i),j,len(args(i))
100 continue
end
with screen o/p
iargc,nargc 1 2
-2 -1 20
-1 -1 20
0 H:SgastlibCOMCHART 40 20
1 3"4 5 6 7 9 20
2 -1 20
3 -1 20
4 -1 20
5 -1 20
6 -1 20
7 -1 20
8 -1 20
9 -1 20
10 -1 20
11 -1 20
12 -1 20
13 -1 20
14 -1 20
15 -1 20
Press any key to continue
0 Kudos
1 Reply
Intel_C_Intel
Employee
517 Views
No bug in GETARG. Use 0 as the first argument to return the name of the executable file on the command line. The confusing thing is that the function NARGS() returns the number of command line arguments including the executable file.
0 Kudos
Reply