CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Fortran Problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 18, 2007, 14:52
Default Fortran Problem
  #1
MM
Guest
 
Posts: n/a
Hi everyone,

How can I assign a variable name to a character variable in fortran. I would like to make an output file for my program but the name of the file would be changed during running and I need to record all of them. I don't want to repeat whole commands for making the file. If someone knows how it could be happened in fortran, I appreciate to let me know.

Thanks MM
  Reply With Quote

Old   April 18, 2007, 15:08
Default Re: Fortran Problem
  #2
pc
Guest
 
Posts: n/a
Write the variable to a character string. For example, for an integer n:

write(filename,'(a5,i2.2)')'file-',n

then open(1,file=filename,....)

This will make files called "file-01","file-02", etc.

Is this what you meant?

  Reply With Quote

Old   April 18, 2007, 15:59
Default Re: Fortran Problem
  #3
MM
Guest
 
Posts: n/a
Thank you so much, it was exactly what I was looking for.
  Reply With Quote

Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User fortran error when running CFX-10 in parallel CFDworker CFX 3 September 22, 2015 09:59
Fortran compiler problem Luke Siemens 2 September 18, 2008 04:43
Problem with Fortran installation. skarp CFX 0 August 4, 2007 08:09
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 07:29
'C' or FORTRAN or 'C++' Yogesh Talekar Main CFD Forum 20 October 21, 1999 05:00


All times are GMT -4. The time now is 22:28.