Re: How to pass a string to/from a function in 77



jane.sync@xxxxxxxxx wrote in message <1138554124.774660.56170@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>...
>I'm trying to pass strings between functions in Fortran 77, but I can't
>find any reference for this... Can anyone help with explaining how to
>send a string to a function and have the function return a string? So
>far I have this:
>
> PROGRAM HELLOWORLD
> IMPLICIT NONE
> Character*256 MyFunc
>
> PRINT *, 'Hello '
> FunctionString()

You need to have an assignment for this, or include it in the PRINT statement.
Myfunc = FunctionString()

>
> END PROGRAM

As suggested befure, move this statemnent to the very end,
and insert a CONTAINS statement here. Same reason as before.

> FUNCTION FunctionString() RESULT(String)
> Implicit None
> Character(*) String

You need to specify a constant length for the result.
e.g., character(len=10) :: String

> String = "World"
> Return
> End


.



Relevant Pages

  • Re: Why cant I xor strings?
    ... What's right about accepting 3^7? ... IMO we have implicit subtyping of integers as vectors or column matrices ... >int ^ string, and there isn't. ...
    (comp.lang.python)
  • Re: Question: Given |X|>0 and |Y|>0, can X x Y be empty?
    ... Even more amazing was your reply, "I'm here to learn from my mistakes; ... THERE ARE *NO* implicit assumptions going on here! ... There is nothing going on here beyond string comparison. ... and 2) set theory is going to be presented IN FIRST-ORDER ...
    (sci.logic)
  • Re: Two Questions about "strlen", "strcat" and "strcpy"
    ... The reasoning is that unsigned values have a larger maximum value and ... incremental string concatenation is simplified ... fact calls to strlen, implicit or not, is the real performance ... People may write strcpy() in "hand coded assembly language" if they ...
    (comp.lang.c)
  • Re: Properties
    ... Creates a private field in the same class as the property and appends ... random string to the the name of property and use that for the field. ... really any different than C# having an implicit destructor even if its not ... Instead of declaring the field outside ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Can a variable hold 2 values simultaneously - a string value and a numeric?
    ... > the same type coercion issues. ... string is implicitly coerced to the appropriate type. ... You recommended as a solution to the implicit ... > "the values" and with the format property set to a number would ...
    (comp.databases.ms-access)