Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

PLEASE, argument with runqq

janviech
Beginner
835 Views
Hello,
I must to open an executable program with a commandline so I'm using the instruction runqq(filename, commandline) but in 'commandline' I have a filname which is opened with an edit box(I can also use systemqq(commandline)). But the program doesn't function. Can you help me please?

My code is:
subroutine main
use dflib
include 'nomfic.inc' !(with variable fichie and command(character*30))
integer*2 res
integer*4 NCL

NCL=len_trim(FICHIE) !Fichie is the name I retrieve in the edit box(t: est)
command=FICHIE(:NCL)
res=runqq('multi ',command)

call exit()
end subroutine


but this code functions (I don't undersand):
subroutine main
use dflib
include 'nomfic.inc'
integer*2 res
integer*4 NCL

command='T:TEST'

res=runqq('multi ',command)
call exit()

end subroutine


0 Kudos
4 Replies
grg99
Beginner
835 Views
write your own runqq subroutine, call it both ways, and check the parameters:

subroutine runqq( p, q )
character p(*), q(*)

print *, 'p = "', TRIM(p), '"'
print *, 'q = "', TRIM(q), '"'

end

... likely one of them is getting messed up. Also it wouldnt hurt to print out "res".







0 Kudos
dbruceg
Beginner
835 Views

Does the string from the edit box have a null terminator? If so, try stripping it.

0 Kudos
janviech
Beginner
835 Views
It doesn't function, it's not a problem of size or reading because with the debugger the variable FICHIE is correctly reading 't:test'.
I tried with createprocess(), it functions with 't:test' but not with FICHIE. The problem come from FICHIE and i don't know why?
Is it a pointer or a target argument?and how using pointer and target?
Thank you.

0 Kudos
Les_Neilson
Valued Contributor II
835 Views

It is most likely the contents of FICHIE contains a trailing NULL character.

Viewing FICHIE in a watch window will not show the null character. (Getting the address of FICHIE via LOC(FICHIE) and putting that addressin a Memory watch window would show the hex values of FICHIE including any trailing null)

In your original post viewing the value of NCL would show whether there were any trailing characters;that isNCL would be > 6

I did a quick test with the following

character(80) :: line

integer :: i

line = 't:test'//char(0) ! append a trailing null

i = len_trim(line)

gives "i" a value of 7 not 6 !

Les

0 Kudos
Reply