Re: variable length strings

From: Steve Lionel (Steve.Lionel_at_REMOVEintelME.com)
Date: 08/19/04


Date: Thu, 19 Aug 2004 13:16:43 -0400

On 19 Aug 2004 09:50:02 -0700, aburry@ieee.org (Mr. Adam Burry) wrote:

>aburry@ieee.org (Mr. Adam Burry) wrote in message news:<f3e1fd4d.0408181158.51dd9a67@posting.google.com>...

>The problem seems to have been: "!DEC$ ATTRIBUTES REFERENCE ::
>strFilename"
>I expected this to be redundant given the earlier REFERENCE directive,
>but apparently it actually does something. Presumably removing the
>hidden length argument?

Yes, that's what it does. This combination specifies that the caller passes
only the address of the character argument, not the length. There is a full
chapter on mixed-language programming in the Visual Fortran Programmer's Guide
which discusses this and related issues.

> CHARACTER*60 fname
> INTEGER strLen
>
> fname = strFilename
> strLen = LEN( fname )
>
>In this case, strLen will be 60 even if LEN( strFilename ) is only 10.
>How does one get the actual length of fname?

You want LEN_TRIM(fname), I assume. (It is not clear what you mean by "actual
length", but I'll assume you mean (with trailing blanks removed).

Steve Lionel
Software Products Division
Intel Corporation
Nashua, NH

User communities for Intel Software Development Products
  http://softwareforums.intel.com/
Intel Fortran Support
  http://developer.intel.com/software/products/support/



Relevant Pages

  • Re: [Q] FORMAT
    ... Steve Lionel ... Software Products Division ... User communities for Intel Software Development Products ... Intel Fortran Support ...
    (comp.lang.fortran)
  • Re: Intel Fortran for Windows, student edition costs $29.
    ... Software Products Division ... User communities for Intel Software Development Products ... Intel Fortran Support ...
    (comp.lang.fortran)
  • Re: ifort and CVF
    ... >not do some benchmarking of your code? ... Software Products Division ... User communities for Intel Software Development Products ... Intel Fortran Support ...
    (comp.lang.fortran)
  • Re: Intel Fortran Compiler
    ... they are successfully executed depends on how faithful the implementation is. ... Software Products Division ... User communities for Intel Software Development Products ... Intel Fortran Support ...
    (comp.lang.fortran)
  • Re: right sequence of included module files
    ... Then I find some of the .f90 are main programs. ... Developer Products Division ... User communities for Intel Software Development Products ... Intel Fortran Support ...
    (comp.lang.fortran)

Loading