Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

error with character length

REDA_A_1
Beginner
1,045 Views

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

0 Kudos
1 Reply
Steven_L_Intel1
Employee
1,045 Views

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

0 Kudos
Reply