Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to/Reading from a subdirectory?

Status
Not open for further replies.

cah2oeng

Civil/Environmental
Feb 29, 2004
32
0
0
US
Hello,
I have a program that outputs a ton of files. I'd like to output each file type to a separate subdirectory under the directory in which the program was executed.

Additionally, since it reads in a ton of input files, I'd like to do the reverse and read them in from a subdirectory as well.

Any input on this is greatly appreciated.

Thanks.
 
Replies continue below

Recommended for you

I'm not sure if there's a more elegant way, but since there is no "path" option for the OPEN command, you must include the path in the file name:

c Example program
character*80 outdir,outfile
character*160 fullname
outdir='NameofSubdir\'
outfile='NameofFile.ext'
c Combine path and file name:
fullname = outdir(1:len_trim(outdir))//outfile
c Print to screen to check:
print*,'Path and File: ',fullname
open(7,file=fullname)
c For example :
write(7,*)data
close (7)
end

I know it's a trivial thing, but having things come out in an orderly fashion always helps me think better. :)
 
Status
Not open for further replies.
Back
Top