Re: How to pass a string to/from a function in 77
- From: "robin" <robin_v@xxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 02:21:18 GMT
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
.
- References:
- How to pass a string to/from a function in 77
- From: jane . sync
- How to pass a string to/from a function in 77
- Prev by Date: Re: How to detect NULL input?
- Next by Date: Re: How to compare two strings?
- Previous by thread: Re: How to pass a string to/from a function in 77
- Next by thread: Nested dummy procedures
- Index(es):
Relevant Pages
|
|