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

Home » Public Forums » archive » quirk End of file encountered before end of program
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: quirk End of file encountered before end of program [message #89876 is a reply to message #89867] Mon, 15 December 2014 07:05 Go to previous messageGo to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Friday, 12 December 2014 14:38:52 UTC+1, LC's No-Spam Newsreading account wrote:
> On Thu, 11 Dec 2014, Jim P wrote:

>
> The original code I had (dating to several years ago, before anonymous
> structures were introduced) used in fact a much more complex mechanism.
>

Wow. Are you sure? Both named and anonymous structures have been there at least since IDL 4.0 (maybe even from the very beginning?), released several _decades_ ago.

It is usually more fruitful if you describe also what you are trying to achieve instead of only what you tried that didn't work.

http://xyproblem.info


-------------

In your case, I really don't see why you cannot use CREATE_STRUCT(tag1, value1, tag2, value2, ...) directly. After all, you must have all tags and values available as variables in your xxx.pro to do what you tried.

I don't know what the contents of your datafile is. Binary or text? But assuming text, one struct tag/value per line, one struct per datafile, and the existence of a procedure PARSELINE that takes a string (line) as input and returns TAG and VALUE, you can do something like this slightly old fashioned code:

datafile = '/some/file'
openr, unit, datafile, /get_lun
line = ''
init = 0
while ~eof(unit) do begin
readf, unit, line
parseline, line, tag, value
if init eq 0 then begin
struct = create_struct(tag, value)
init = 1
endif else begin
struct = create_struct(tag, value, struct)
endelse
endwhile
free_lun, unit

Should work for very old IDL versions.

--
Yngvar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: reading binary file with READ_BINARY
Next Topic: IDLgrPolygon question

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

Current Time: Wed Oct 08 15:11:41 PDT 2025

Total time taken to generate the page: 0.00402 seconds