04-16-2012 09:53 PM
Can everyone tell me how to write the fortran code?
Thanks!
04-17-2012 02:21 AM - edited 04-17-2012 02:22 AM
I'm sure a Fortran forum is a much better place to ask this. The obvious question there would be how to pass string data from a different environment (C program or Visual Basic for instance) to a Fortran DLL. They can for sure tell you that, here we do LabVIEW. Fortran I only know by name and that it is something I'm never going to learn.
04-19-2012 11:02 AM
Hi,
I'm not a Fortran programmer, so I'm sure this is a pretty ugly way to do it, but it did work:
I did something like this:
subroutine MySubroutine(FileName_RT_Byte, FLen)
BYTE :: FileName_RT_Byte(100)
BYTE :: FileName_RT_Byte2(100)
CHARACTER(LEN=100) :: FileName_RT_Char
INTEGER :: FLen
EQUIVALENCE(FileName_RT_Byte2,FileName_RT_Char) !Make the character filename equivalent to incoming filename byte array
FileName_RT_Byte2(:) = FileName_RT_Byte(:)
!Test code (un-comment to use)
!open(unit = 11, file="TEST.txt")
!WRITE(11,*) 'TEST12345'
!WRITE(11,*) 'aa '//FileName_RT_Char(1:FLen)//'|2'
!WRITE(11,*) FLen
!WRITE(11,*) 'TEST12345'
!close(11)
!Assign PriFile based on passed in string
PriFile = FileName_RT_Char(1:FLen)
!Remainder of the code deleted
end subroutine MySubroutine
Hope this helps!
04-19-2012 11:03 AM
Ergh, the smilies were inserted by the forum, replace them with a colon then close parenthesis
04-19-2012 08:22 PM
Thank you very much!
I have got it a few days ago, and not need the length of the filename or EQUIVALENCE command.
Best regards