- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Rebuilding an old Cray F77 program that had the following:
integer lpref
character*(*) prefix
lpref = len(prefix)
where "len" was a fuction returning the length of "prefix"
Did a quick google but couldn't find an easiest way to find the lenght of a character string in intel fortran.
Could you suggest the easiest way? Surely there is one and it is just my search abitlities that are lacking.
Thanks
integer lpref
character*(*) prefix
lpref = len(prefix)
where "len" was a fuction returning the length of "prefix"
Did a quick google but couldn't find an easiest way to find the lenght of a character string in intel fortran.
Could you suggest the easiest way? Surely there is one and it is just my search abitlities that are lacking.
Thanks
Link kopiert
5 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
LEN is the standard intrinsic for this. What's the problem?
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
LEN(charvar) will give you the length of the character variable.
LEN_TRIM(charvar) will give you the length of the string (leading spaces included)
That's my understanding at least.
LEN_TRIM(charvar) will give you the length of the string (leading spaces included)
That's my understanding at least.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
> LEN_TRIM(charvar) will give you the length of the string after removing trailing spaces (leading spaces included)
There is nothing specific to Cray Fortran here. Furthermore, len is a standard intrinsic function and its definition is not vendor-dependent.
Googling "Fortran len function" generated a number of pertinent links.
There is nothing specific to Cray Fortran here. Furthermore, len is a standard intrinsic function and its definition is not vendor-dependent.
Googling "Fortran len function" generated a number of pertinent links.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
And for completeness I should add that LEN_TRIM looks at trailing spaces only. It does not consider a NUL or a TAB to be a space.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Thanks for all the replies folks.
I had added "implicit none" to clear up the variables in the subroutines plus added several compiler attributes in the process. Doing some clean up and then recompilng, it disappeared so it could have been commenting of the variable itself or I didn't look closely enough.
I had added "implicit none" to clear up the variables in the subroutines plus added several compiler attributes in the process. Doing some clean up and then recompilng, it disappeared so it could have been commenting of the variable itself or I didn't look closely enough.

Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite