|
|
|
Re: calling another directory within program [message #47234 is a reply to message #47233] |
Sun, 29 January 2006 09:18  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
pimpk24@hotmail.com writes:
> Iam an IDL newbie and have a question that I believe is pretty
> straighforward for most of you:
>
> I am writing a program that has various subroutines that are withing my
> working directory. However, in the beginning of the program I want to
> be able to call and restore a '.sav' file that is in another
> subdirectory than my current working one. Basically, I have a 'data
> directory' and 'idl programs directory' and need to be able to access
> both of them within the program that Iam writing.
>
> I have tried the !PATH function but I am still getting a 'file cannot
> be found error'- perhaps I am not using the proper syntax though?
No, !PATH is not what you want. You want to be able to
specify a file name inside your program. To do that in
a way that is portable across computer architectures
(you THINK you will be the only one who uses this program,
but you might be surprised at how famous you become
in IDL programming circles!) use the FILEPATH function
to construct the file name.
Check the IDL documentation for CD while you are looking
up FILEPATH, too. If you are interested in locating your
"data" directory with respect to your "programs" directory,
check out ProgramRootDir:
http://www.dfanning.com/programs/programrootdir.pro
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|