Re: Conversion from int to char




"Ron Ford" <ron@xxxxxxxxxxxxxxx> wrote in message
news:8fk459mm0vzg$.dlg@xxxxxxxxxxxxxxxxxx
On Fri, 29 Aug 2008 07:56:46 -0700 (PDT), michaelmetcalf@xxxxxxxxxxxxxx
posted:

On Aug 29, 4:28 pm, fm2766 <fm2...@xxxxxxxx> wrote:
Hello, I have to convert integers in characters; for example: from
number i=123456 to string c="123456".
I could write in a file the variable "i", and later read it as a
variable "c", but this method seems to me very inefficient.
Some suggestions?

Well, that's almost what you do, however, not to an external file but
to an 'internal' one as defined by your c, as in:

write(c, '(i6)') i

Is c a default character variable here?
--
Wealth - any income that is at least one hundred dollars more a year than
the income of one's wife's sister's husband. 6
H. L. Mencken
Yes, following the example above, it is.
If i=123456
and c is a string that can hold at least six characters, the the result of
write(c, '(i6)') i is that c = '123456'

Personally, I found the internal read/write syntax much easier to follow
that either the nonstandard encode or nonstandard decode functions.
Jim


.