Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Discussions

Character length argument mismatch problem

Wee_Beng_T_
Beginner
1,660 Views

Hi,

I've no problem compiling when my assigned character variable is longer than the actual. However, in ifort linux, I got the error msg:

Character length argument mismatch.

My subroutine is something like:

subroutine cp_cal(filename)

character, intent(in) :: filename

...

end subroutine cp_cal

My filename's length is not fixed. It can be

call cp_cal(4.txt) or call cp_cal(cp4.txt).

How do I solve this problem? thanks

 

0 Kudos
3 Replies
Steven_L_Intel1
Employee
1,660 Views
What you have declared is a character argument of length one. What you want is:

character (*)

This will take on the length of the argument and that was passed.
0 Kudos
Wee_Beng_T_
Beginner
1,660 Views
oic ... thanks alot!
0 Kudos
Wee_Beng_T_
Beginner
1,660 Views
Ya it worked. Tks!
0 Kudos
Reply