LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone know how to pass a character array into Fortran from Labview?


Can everyone tell me how to write the fortran code?

Thanks!

 

0 Kudos
Message 11 of 15
(855 Views)

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.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 12 of 15
(851 Views)

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!

 

 

0 Kudos
Message 13 of 15
(831 Views)

Ergh, the smilies were inserted by the forum, replace them with a colon then close parenthesis

0 Kudos
Message 14 of 15
(830 Views)

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

0 Kudos
Message 15 of 15
(817 Views)