Re: IDL input files. [message #54529 is a reply to message #54528] |
Mon, 18 June 2007 11:35   |
ryanselk
Messages: 16 Registered: May 2007
|
Junior Member |
|
|
On Jun 18, 11:38 am, David Fanning <n...@dfanning.com> wrote:
> ryans...@gmail.com writes:
>> ive been reading some manuals and books for IDL but im not sure how to
>> solve this likely simple problem.
>
> Oh, dear. Which books have you been reading!?
>
> You need to explain your problem a little bit better
> for us. You code doesn't work for many reasons, but
> one big reason is that you are trying to read from
> a file you opened for writing. And I can't tell from
> your example, what it is you are trying to do.
>
> Do you wish to *create* a file (OPENW and PRINTF), or
> do you wish to *read* from a file (OPENR and READF)?
>
> Or, do you wish to ask the user a question (maybe you
> needhttp://www.dfanning.com/widget_tips/popup.html)
> and then write the answers in a file?
>
> I'm very confused by your question. Do you think you
> could clarify for us?
>
> 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.")
Whoops, its just reading from a file, I messed with it earlier and
forgot to change it back, It should be:
PRO inputer
print, 'starting input'
getfile = DIALOG_PICKFILE (/READ)
print, getfile
OPENR, 1, getfile
POINT_LUN, 1, 0
IDL_Name = ' ' ; want extendable length if possible.
READU, 1, IDL_Name
print, IDL_Name
POINT_LUN, 1, 0
CLOSE, 1
END
Ideally,
This idl file just reads whatever file is selected and stores the name
variable to IDL_Name .
But what I want to do is 'search' the file opened for certain words,
when it finds them I want to be able to store that value to an IDL
variable.
Im going to need to declare more variables then IDL_Name, but im
unsure how to do it.
ie: if the user selects this file:
Name = {Joe}
Department = {CS}
Age = {25}
I want in IDL to have those 3 variables stored ie:
IDL_Name = Joe
IDL_DEPARTMENT = CS
IDL_AGE = 25
But, if the file reads:
Age = {30}
Department = {Science}
I would want IDL to return;
IDL_DEPARTMENT = Science
IDL_Age = 30
I think i need to use some sort of 'search file' command. I hope this
is clearer, sorry for being unclear before.
Thank you! and David your website has been of help to me frequently in
the past.
|
|
|