October 19th, 2006, 05:02 PM
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:
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.
October 20th, 2006, 07:39 AM
Please start your own thread.
Web Design Tips
- Posting and You
If I've been helpful, and/or you're really nice, consider buying something from my Amazon.com wishlist.
The club is dead.
- There is no room for pride when trying to be the best at what you do.
- Friends don't let friends use bad code.
October 20th, 2006, 10:19 PM
There is already a thread with this question ... and there is already an answer
October 26th, 2006, 12:47 PM
At least with F90 you can use write and fmt. I believe it was something like:
WRITE (chars,’(’ // .fmt. n // ’)’) n
(n is integer)
Oh, sorry. I guess I was just a bit too enthusiastic to reply cause I once in my life knew the (partial) answer to something :/ Dang. Perhaps I someday will be the fastest
Admitt you do not know - and become wise.
Pretend to be wise - and stay stupid.
October 26th, 2006, 09:06 PM
Originally Posted by gaanee
the concatanation operator "//" deosn't work since one argument is integer, so I wrote a format statement and then write it to a file then read it from the file. seems to be some extra work in opening, writing and then reading it from a file, but it works. I've to write it and then read, since it seems that if u have a format statement, then the only place u can use it is a write statement.
does anyone know of a better way?
October 26th, 2006, 11:02 PM