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 #49630 is a reply to message #49629] Fri, 04 August 2006 11:04 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
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.

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)

--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Ph: (301)763-8000 x7748
Fax:(301)763-8545
[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:58:12 PDT 2025

Total time taken to generate the page: 0.00250 seconds