() . character (star) - . (*) , , . , . . Fortran 2003 , . - .
, Fortran:
module test_func_mod
contains
function readCString()
use iso_c_binding
character (kind=c_char, len=512) :: readCString
character (kind=c_char, len=511) :: str
read(1, *) str
readCString = TRIM(str) // C_NULL_CHAR
return
end function readCString
end module test_func_mod
program test
use test_func_mod
open (unit=1, file="temp.txt")
write (*, *) readCString()
end program test
Fortran C, ISO C. , , Fortran C , C. , , . Fortran 2003, . , .. ISO C . , (Fortran, C ) stackoverflow, .