Passing string from IDL to Fortran [message #90466] |
Tue, 03 March 2015 11:15  |
Sir Loin Steak
Messages: 42 Registered: January 2012
|
Member |
|
|
Hi all,
I am calling a Fortran subroutine from IDL, and it has been set up in a way that the filepath to some data is passed in via the argument list. So, in the subroutine we have:
character*(*),intent(in) :: dset ! path to datafiles
I initially just passed the string as normal from IDL via the call_external routine, which didn't work. Then I read it should be converted to byte before being used, so I did:
filepath = '/path_to_files/'
byte_filepath = byte(filepath)
and then passed byte_filepath via call_external to the Fortran subroutine. However, this doesn't work either (from the Fortran routine when I do print*, len_trim(dset) it gives a value of 0).
Can anyone offer any help? I have searched online and on this newsgroup and it seems to be a common query, but one which I can find no answer to. I don't need to alter the filepath or anything in Fortran - I just want to specify it in IDL and then pass it to Fortran.
For now I have just hardcoded the filepath into the Fortran routine and deleted it from the argument list, but I would like to know how to get it done using call_external. (I'm using Red Hat if that makes a difference to the solution).
Cheers,
Liam
|
|
|