Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 19th, 2006, 05:02 PM
gaanee gaanee is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 163 gaanee User rank is Sergeant (500 - 2000 Reputation Level)gaanee User rank is Sergeant (500 - 2000 Reputation Level)gaanee User rank is Sergeant (500 - 2000 Reputation Level)gaanee User rank is Sergeant (500 - 2000 Reputation Level)gaanee User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 12 h 37 m 29 sec
Reputation Power: 25
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.

Reply With Quote
  #2  
Old October 20th, 2006, 07:39 AM
cybersaga's Avatar
cybersaga cybersaga is offline
I have a red lunch bag
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jan 2005
Location: The armpit of Niagara
Posts: 3,125 cybersaga User rank is Major (30000 - 40000 Reputation Level)cybersaga User rank is Major (30000 - 40000 Reputation Level)cybersaga User rank is Major (30000 - 40000 Reputation Level)cybersaga User rank is Major (30000 - 40000 Reputation Level)cybersaga User rank is Major (30000 - 40000 Reputation Level)cybersaga User rank is Major (30000 - 40000 Reputation Level)cybersaga User rank is Major (30000 - 40000 Reputation Level)cybersaga User rank is Major (30000 - 40000 Reputation Level)cybersaga User rank is Major (30000 - 40000 Reputation Level)cybersaga User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 4 h 27 m 52 sec
Reputation Power: 338
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.
  • There is no room for pride when trying to be the best at what you do.
  • Friends don't let friends use bad code.
The club is dead.

Reply With Quote
  #3  
Old October 20th, 2006, 10:19 PM
mawe mawe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 394 mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 10 h 6 m 47 sec
Reputation Power: 50
There is already a thread with this question ... and there is already an answer

Reply With Quote
  #4  
Old October 26th, 2006, 12:47 PM
Mazzie's Avatar
Mazzie Mazzie is offline
Making a mistake is not sin.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Location: Finland
Posts: 406 Mazzie User rank is Captain (20000 - 30000 Reputation Level)Mazzie User rank is Captain (20000 - 30000 Reputation Level)Mazzie User rank is Captain (20000 - 30000 Reputation Level)Mazzie User rank is Captain (20000 - 30000 Reputation Level)Mazzie User rank is Captain (20000 - 30000 Reputation Level)Mazzie User rank is Captain (20000 - 30000 Reputation Level)Mazzie User rank is Captain (20000 - 30000 Reputation Level)Mazzie User rank is Captain (20000 - 30000 Reputation Level)Mazzie User rank is Captain (20000 - 30000 Reputation Level)  Folding Points: 32554 Folding Title: Starter FolderFolding Points: 32554 Folding Title: Starter Folder
Time spent in forums: 1 Week 1 Day 6 h 20 m 50 sec
Reputation Power: 208
Send a message via MSN to Mazzie
At least with F90 you can use write and fmt. I believe it was something like:

WRITE (chars,’(’ // .fmt. n // ’)’) n

(n is integer)

EDIT:
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
__________________

http://c-ohjelmoijanajatuksia.blogspot.com/
http://maz-programmersdiary.blogspot.com/
Admitt you do not know - and become wise.
Pretend to be wise - and stay stupid.

Reply With Quote
  #5  
Old October 26th, 2006, 09:06 PM
gaanee gaanee is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 163 gaanee User rank is Sergeant (500 - 2000 Reputation Level)gaanee User rank is Sergeant (500 - 2000 Reputation Level)gaanee User rank is Sergeant (500 - 2000 Reputation Level)gaanee User rank is Sergeant (500 - 2000 Reputation Level)gaanee User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 12 h 37 m 29 sec
Reputation Power: 25
Quote:
Originally Posted by gaanee
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.



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?

Reply With Quote
  #6  
Old October 26th, 2006, 11:02 PM
mawe mawe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 394 mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level)mawe User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 10 h 6 m 47 sec
Reputation Power: 50
Quote:
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?

Hello? Did you read my answer in your other post?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > [Fortran77] concatenate an integer with a character data type

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap