Re: Conversion from int to char
- From: Sebastian Gallinat <sebastian.gallinat@xxxxxxxx>
- Date: Fri, 29 Aug 2008 17:06:10 +0200
fm2766 schrieb:
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?
First, declare a character variable which is long enough to hold your bigest integer number:
character(len=15):: iBuf
Second, use the write-statement performing an internal write to the character variable:
write(unit=iBuf, fmt=*) i
If needed, do something for adjusting the characters:
iBuf = adjustl(iBuf)
If you have some docs for the used compiler by hand, you will find this feature under internal write statement. Hope, this helps,
Sebastian.
.
- Prev by Date: Re: Project dependency of CVF 6.6c
- Next by Date: Re: Conversion from int to char
- Previous by thread: odd compiler complaints with large numbers
- Next by thread: Re: Conversion from int to char
- Index(es):