Re: Save an array to memory for another program to read it
- From: Dan Nagle <dannagle@xxxxxxxxxxx>
- Date: Tue, 20 Jun 2006 23:11:17 GMT
Hello,
Whoops, I got it backwards. <sigh>
Dan Nagle wrote:
Hello,
Nektarios - Greece wrote:I run a program and suppose it creates an array A.
I need the program to store into memory this array, end itself and when immediately runs again to load this array again from the memory.
H O W ?
One way is something like this
test to see if a file exists, named, say, array_a.dat
if it exists, read it
if not, compute A and write it to a file named array_a.dat
(You can choose any name you want for the file,
I chose array_a.dat for illustration.)
I am new in Fortran. So, please help me.
Thus,
program ...
real(...), dimension(...) :: a
inquire( file='array_a.dat', exists= file_exists)
if( file_exists )then
open( unit= a_unit, file= 'array_a.dat', form= 'unformatted', &
access= 'sequential', status= 'old')
call compute_array_a( a)
write( unit= a_unit) a
else
open( unit= a_unit, file= 'array_a.dat', form= 'unformatted', &
access= 'sequential', status= 'new')
read( unit= a_unit) a
endif
end program ...
I left out a bunch of stuff, but that's one general way
to solve my understanding of your problem.
HTH
--
Cheers!
Dan Nagle
Purple Sage Computing Solutions, Inc.
.
- References:
- Save an array to memory for another program to read it
- From: Nektarios - Greece
- Re: Save an array to memory for another program to read it
- From: Dan Nagle
- Save an array to memory for another program to read it
- Prev by Date: Re: Save an array to memory for another program to read it
- Next by Date: Re: help for reading a binary file
- Previous by thread: Re: Save an array to memory for another program to read it
- Next by thread: Re: Save an array to memory for another program to read it
- Index(es):
Relevant Pages
|
|