error with character length

error with character length

Hello,

I was using the following code in fortran 90 for reading different input files. But when i used intel fortran it gave me this error

Error 1 error #6362: The data types of the argument(s) are invalid. [LEN] D:\3D_U_1 - Prism_int\sub1.f90 6

Error 2 error #6415: This name cannot be assigned this data type because it conflicts with prior uses of the name. [FNAME] D:\3D_U_1 - Prism_int\sub1.f90 6

" fname : is the name of different file that i need to read"

Subroutine InputNum(fname,nv)

character(len=len(fname)), intent(in) :: fname
integer, intent(out) :: nv

Open(10,file = fname, STATUS='old')
Read(10,*) nv
Close (10)

End subroutine InputNum

Subroutine getmatrix_int(fname,v,nv,z)

character(len=len(fname)), intent(in) :: fname
integer, intent(in) :: nv,z
Integer, dimension(nv,z), intent(out) :: v
integer :: i, stat

Open(10,file = fname, STATUS='old')
Read(10,*)
i = 1

Do

Read(10,*,iostat=stat) (v(i,j),j=1,z)

if (stat < 0) exit
i = i + 1

End do
Close (10)

End subroutine Getmatrix_int

Regards

Reda

2 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

The statement:

character(len=len(fname)), intent(in) :: fname

is incorrect because it is trying to use a characteristic of fname to declare itself. I think what you want is:

character(len=*), intent(in) :: fname

Steve - Intel Developer Support

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi