Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert integer to character type in F90

Status
Not open for further replies.

Mauro2005

Technical User
Jun 3, 2005
2
US
Hi simple example:
"
integer :: year .....
character:: p1*4, ....
.
.
DO 100 i=fyear, lyear
year = i
p1=trim(year)
write(*,*) p1
..."

Compiling, complaint of course that year is incorrect kind for the function trim.

How to convert an integer to a character ? any suggestions

 
Not sure what you want. At a guess it is something like
Code:
 DO 100 i=fyear, lyear
    year = i
    write (p1, '(I4)') year
    ... do whatever with p1
100 continue
Writing to p1 will convert year into character form in p1
 
Thanks at lot,

That's what I was trying to accomplish, basically I am writting a program that open/read several files and compile the data into a single file. The names of files include year, month, etc, that is where the conversion was need it.

thank you again, Mauricio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top