- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
character (*)
This will take on the length of the argument and that was passed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
oic ... thanks alot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ya it worked. Tks!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page