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

Home » Public Forums » archive » Re: file_lines and expand path
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: file_lines and expand path [message #49629 is a reply to message #49628] Fri, 04 August 2006 11:57 Go to previous messageGo to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Paul van Delst wrote:
> FL wrote:
>
>> Hi,
>>
>> I am implementing file_lines in FL and was wondering what to return
>> when the input path expands to multiple files. The IDL reference guide
>> says nothing. I have run IDL and got curious result:
>>
>> IDL> help, file_lines('*.pro')
>> <Expression> LONG64 = 15
>>
>> I have 448 .pro files in the current directory, with a total of 10k
>> lines.
>> IDL seems to be randomly picking a single file and reporting its
>> length (probably the first match in readdir()).
>>
>> What do you expect to get?
>>
>> Possibilities:
>>
>> 1. never expand (but why do we have NOEXPAND then?)
>> 2. give an error message if the expansion results in more than one file
>> 3. return the total length of files
>> 4. return the total length of files if a new keyword TOTAL was set
>> 5. do as IDL, pick a single file silently
>
>
> Well, if the routine allows for wildcard inputs, then I wouldn't expect
> *any* of the above.
>
> What I would expect would be an array (in this case 448 elements in
> size) containing the lengths of *each* file that matched the wildcard
> expression, e.g.

what about a structure containing the array you said, and another one
containing the complete file name, so then it becomes fairly easy to
open the files (and the order in wich the files are read in the
directory is not a problem). This would allow you to read only files
that have more than X lines in a very convenient way!

Jean

>
> IDL> help, file_lines('*.pro')
> <Expression> LONG64 = Array[448]
>
> Just because IDL does it wrong, doesn't mean you have to. :o)
>
> paulv
>
> p.s. Maybe FL should have the ability to run just like IDL. I.e. you set
> some sort of environment variable, say, FL_RUNLIKE_IDL=true, and it
> performs like IDL (i.e. giving the incorrect result (IMO) as in the
> above example). Set it to false, and FL behaves like a regular person
> would intuitively expect. :o)
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: nearest number
Next Topic: Re: CXFORM on WinXP

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

Current Time: Wed Oct 08 16:51:55 PDT 2025

Total time taken to generate the page: 0.00423 seconds