|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Concatenate integer with a character data type
Is there any way in Fortran77 to concatenate an integer with a character data type?
Basically, I'm trying to create filenames in a loop like: file01.out file02.out file03.out .... ....... for this I need to concatenate 'file' which is a character with 01 which is an integer, and I cannot simply do file//01, since the data types are different. Is there a way to get around this issue in Fortran77. is there any function similar to sprintf in F77. |
|
#2
|
|||||
|
|||||
|
Hi!
fortran Code:
I leave the numbers 01 - 09 as an exercise to you (to be honest I have no idea how to do that )Regards, mawe |
|
#3
|
|||
|
|||
|
Re:Concatenate integer with a character data type
Hi,
I hope it might work. PROGRAM concatinating_int_char IMPLICIT NONE CHARACTER(LEN = 20 ) :: file_name CHARACTER(LEN = 20 ) :: file_char INTEGER :: i file_char = '010203040506070809' DO i = 1,18,2 file_name = 'output'// file_char(i:i+1)//'.dat' WRITE(*,*) file_name END DO END PROGRAM concatinating_int_char Enjoy, Rahu. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Concatenate integer with a character data type |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|