comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Including ASCII file in .sav ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Including ASCII file in .sav ? [message #59122] Wed, 12 March 2008 07:03
David Fanning is currently offline  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 Go to previous message
David Fanning is currently offline  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 Go to previous message
Vince Hradil is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Including ASCII file in .sav ?
Next Topic: Re: How to plot the magnetic field vector along the trajectory

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 16:47:30 PDT 2025

Total time taken to generate the page: 1.43644 seconds