convert an integer to string

Hi,

anyone knows how to convert an integer to string in pg fortran? the usual technique i use fail.

i just want to convert “myid” which is an integer to a string.

thanks

Hi istaz,

Typically this is done with an internal write to the string:

% cat itos.f90
integer n
character*80 str
n=100
write(str,*), n
print *, n
end
% pgf95 itos.f90
% a.out
          100

Note that you may need to use a format instead of ‘*’ if you’re doing more complex conversions.

Hope this helps,
Mat