comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Unsatisfactory 'file_test()' behavior
items: Re: Unsatisfactory 'file_test()' behavior

Unsatisfactory 'file_test()' behavior
type: item
description: Hi all-- If I do e = file_test('') that is, test for the existence of a file whose name is a zero-length string, I get e = 1. This is not good ! (Using IDL v5.4 WinNT 4.0). Matt Feinstein does not include his email address in the text of usenet postings. -------- Harvard Law of Automotive Repair: Anything that goes away by itself will come back by itself.
creator: mfein
date: 2001-12-17T14:43:41-00:00

Re: Unsatisfactory 'file_test()' behavior
type: item
description: Matt Feinstein wrote: > If I do > > e = file_test('') > > that is, test for the existence of a file whose name is a zero-length > string, I get e = 1. This is not good ! (Using IDL v5.4 WinNT 4.0). How about this: FUNCTION FILETEST, FILE, VERBOSE=VERBOSE ;- Returns true (1B) if the named file can be ;- opened for reading, and false (0B) otherwise ;- Try opening the file for reading openr, lun, file, /get_lun, error=error ;- Check error status if (error eq 0) then begin result = 1B free_lun, lun endif else begin result = 0B if keyword_set(verbose) then $ message, !err_string, /continue endelse ;- Return result return, result END IDL> help, filetest('') <Expression> BYTE = 0 IDL> help, filetest('', /verbose) % FILETEST: OPENR: Null filename not allowed. <Expression> BYTE = 0 Cheers, Liam. Practical IDL Programming http://www.gumley.com/
creator: Liam E. Gumley
date: 2001-12-20T18:43:22-00:00