Re: Including ASCII file in .sav ? [message #59122] |
Wed, 12 March 2008 07:03 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
wtt writes:
> I have a text file that I would like to have displayed when the user
> selects a certain menu item. Is there something special that I need to
> do in order to reference this text file? It is included in the
> project. I looked at the OPENR description, and it seems to want to
> open files from the filesystem.
Typically, you include the text file with the save file
in the distribution of the software, then refer to it by
relating it to the location of the save file. PROGRAMROOTDIR
is useful for this purpose:
http://www.dfanning.com/programs/programrootdir.pro
In other words, suppose your save file is stored in
a directory named "coyote", and the data files are
stored in a sub-directory of coyote, named "data".
Then, the program would refer to the "data" directory
like this:
file = Filepath(Root_Dir=ProgramRootDir(), Subdir='data', $
'mydatafile.txt')
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Including ASCII file in .sav ? [message #59123 is a reply to message #59122] |
Wed, 12 March 2008 07:03  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
wtt writes:
> I have a text file that I would like to have displayed when the user
> selects a certain menu item. Is there something special that I need to
> do in order to reference this text file? It is included in the
> project. I looked at the OPENR description, and it seems to want to
> open files from the filesystem.
Typically, you include the text file with the save file
in the distribution of the software, then refer to it by
relating it to the location of the save file. PROGRAMROOTDIR
is useful for this purpose:
http://www.dfanning.com/programs/programrootdir.pro
In other words, suppose your save file is stored in
a directory named "coyote", and the data files are
stored in a sub-directory of coyoyte, named "data".
Then, the program would refer to the "data" directory
like this:
file = Filepath(Root_Dir=ProgramRootDir(), Subdir='data', $
'mydatafile.txt')
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Including ASCII file in .sav ? [message #59124 is a reply to message #59123] |
Wed, 12 March 2008 07:00  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Mar 12, 8:54 am, wtt <wtripl...@gmail.com> wrote:
> Dear all,
>
> I have a text file that I would like to have displayed when the user
> selects a certain menu item. Is there something special that I need to
> do in order to reference this text file? It is included in the
> project. I looked at the OPENR description, and it seems to want to
> open files from the filesystem.
>
> Thanks very much,
> Bill
Well, not sure if this what you want, but you could
1-read the ascii file into a string array/matrix
2-save that string array in a .sav file
3-have you program restore the .sav file and display the string array
the way you want
|
|
|