[futurebasic] Re: Listing Files in a folder (more)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 1998 : Group Archive : Group : All Groups

From: tatewake@... (TJ Grant)
Date: Tue, 2 Jun 1998 16:06:57 -0500
>What's the cleanest way of simply checking whether the specified file, and/or
>file of specified type, exists in the given location? I don't need to open it
>or do anything with it, just look to see whether it's there.

This one I do know; I got it from the Staz site the other day:

'---------------------------------------
'FileExists
'---------------------------------------
CLEAR LOCAL MODE
DIM pBlk.ioHFQElSiz
LOCAL FN FileExists(fileName$,vRefNum%)
  'set up param block
  pBlk.ioVRefNum%  = vRefNum%
  pBlk.ioNamePtr& = @fileName$
  'get file info
END FN = FN HGETFILEINFO(@pBlk) = _noErr
'=========================================

'This is how you would call the function:

WINDOW 1
myVRefNum = SYSTEM(_aplVol)
filename$ = "MyFile"
LONG IF FileExists(filename$,myVRefNum)
  PRINT "The file exists."
XELSE
  PRINT "The file does not exist."
END IF



~ An FB revolution? I am there! ~

-- TJ Grant (tatewake@...)
Inspired Software. http://inspired.netstreet.net/
Macintosh, Dos, Windows, and BeOS software solutions.
Phone: 407-728-7563
....................................
.MacSloMo: 6502 emulation in FB!   .
.http://inspired.netstreet.net/POC/.
....................................