46 INTEGER,
INTENT(in):: ndigits, intvalue
47 character,
INTENT(out):: charvar(ndigits)
48 INTEGER:: idigit,digit,intval,digval,tenpower
49 character(1):: digchar
51 do idigit = ndigits, 1, -1
52 tenpower = 10**(idigit-1)
53 digit = int(intval/tenpower)
55 write (
logmessage, *)
'Too large number ',intvalue,
' for this character array of length ', ndigits
59 digval = digit*tenpower
60 intval = intval-digval
61 digchar= char(48+digit)
62 charvar(ndigits-idigit+1) = digchar