For Programmers: Free Programming Magazines  


Home > Archive > Fortran > March 2004 > Re: Is there any standered function which converts a character array to









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Is there any standered function which converts a character array to
Arjen Markus

2004-03-27, 12:18 am

Noby wrote:
>
> Is there any standered function which converts a character array to a
> character string?
>
> (I use G77 compiler)


Not to my knowledge, but it is not that hard to do:

subroutine carstr( array, string )
character*1 array(*)
character*(*) string
do 110 i = 1,len(string)
string(i:i) = array(i)
110 continue
end

Note: this assumes that the number of elements in the
array is at least as large as the length of the string
to which they should be copied.

Also note: it is a subroutine (!) not a function (returning
function results with a variable length is tricky, to say
the least)

Regards,

Arjen
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com