I'm trying to open a file a file that's contem a number a = 200 using function:
program test_func
implicit none
real :: Num,a
open(10, file='tabelateste.txt', status='old')
read(10,*)a
print*, 'number in file'
print*, a
print*, Num
end program
real function Num()
implicit none
real :: a
open(10, file='tabelateste.txt', status='old')
read(10,*)a
Num = a
end function
the first print, run as expected, but the second no, what I'm doing wrong? a function in Fortran can read a file?