LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-12-2012, 10:02 PM   #1
s_hy
LQ Newbie
 
Registered: Jan 2012
Distribution: openSuse
Posts: 11

Rep: Reputation: Disabled
converting integer data to string in fortran 90


hi all,

i have the following code:

Code:
character(len=20) :: filename
integer :: n
do n = 1,600
  write (filename, "I0") n
  open (unit=110,file='wave'//trim(filename)//'.dat',action = 'write')
  do i = iinit+1,ilast-1
   !boundary condition
     u(iinit,n+1) = 0
     u(ilast,n+1) = 0
     !end of boundary condition
     u(i,n+1) = 2*(1-(alpha**2))*u(i,n)-u(i,n-1) + (alpha**2)*(u(i+1,n)+u(i-1,n))

   Print*,'i,n,u(i,n+1)=',i,' ', n,' ', u(i,n+1)  
   Write (110,*)'i,n,u(i,n+1)=',i,' ', n,' ', u(i,n+1) 
   close  (unit = 110)
   end do !i
end do !n
what actually i want is to produce automatically a file at a time in the loop with the name ending in a counter, for example: wave1.dat, wave2.dat,wave3.dat,.......,wave599.dat,wave600.dat...but, my programming didn't run properly. Can anyone advice what is wrong with my code.

thanks
 
Old 03-13-2012, 03:53 PM   #2
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 735

Rep: Reputation: 76
Hi.

See http://www.linuxquestions.org/questi...n-loop-889008/ for a closely related problem and solution ... cheers, makyo
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting string to integer in BASH pgb205 Programming 17 08-31-2010 08:38 PM
[SOLVED] How to convert string to integer back to string C++ LazerPhreak Programming 1 03-13-2010 07:32 PM
converting string in integer in bash script dziadgba Linux - Newbie 5 08-31-2009 05:59 PM
converting integer value to hexadecimal string in C - any suggestions?? woodywellhung Programming 3 04-24-2004 05:27 PM
Converting integer types... JStew Programming 3 12-03-2002 08:53 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration