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

Home » Public Forums » archive » Re: fstat, file_info and file_test
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: fstat, file_info and file_test [message #35087 is a reply to message #35086] Wed, 14 May 2003 09:13 Go to previous messageGo to previous message
Richard Younger is currently offline  Richard Younger
Messages: 43
Registered: November 2000
Member
Ben Tupper wrote:
[...]
> What I would like to have is a function similar to:
>
> result = FILE_ISOPEN(filename)
>
> that returns a 1 (for open) or a 0 (for closed). Or, perhaps better in
> the long run, I'd like to see an /ISOPEN keyword added to FILE_TEST.

Hi Ben.

I don't think IDL associates file names with open files except through LUNs,
so I can only think of the brute force method:

FUNCTION IsFilenameOpen, filename

COMPILE_OPT idl2

test_struc = Fstat(0)
struc_array = Replicate(test_struc, 129)

FOR i=1, 128 DO BEGIN
struc_array[i] = Fstat(i)
ENDFOR

index = Where(struc_array.name EQ File_Expand_Path(filename), count)

IF count EQ 0 THEN RETURN, 0 ELSE RETURN, 1

END

Wouldn't want to put it in an inner loop, though.

Good luck,
Rich


--
Richard Younger
younger@spaMIT.edu (with obvious modification)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: replace array's elemets
Next Topic: new object from a save/restore doesn't execute init function

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

Current Time: Wed Oct 08 18:22:58 PDT 2025

Total time taken to generate the page: 0.00460 seconds