FListDir (LabVIEW Manager Function)

MgErr FListDir(path, list, typeH);

Purpose

Determines the contents of a directory.

The function fills the handle passed in list with a CPStr, where the cnt field specifies the number of concatenated Pascal strings that follow in the str[] field. If typeH is not NULL, the function fills the handle passed in typeH with the file type information for each filename or directory name stored in list.

Parameters

Name Type Description
path Path Path of the directory whose contents you want to determine.
list CPStrHandle Handle in which FListDir stores a series of concatenated Pascal strings, preceded by a 4-byte integer field, cnt, that indicates the number of items in the buffer.
typeH FileType Handle in which FListDir stores a series of FileType records. If typeH is not NULL, FListDir stores one FileType record in typeH for each Pascal string in list. The nth FileType in typeH denotes the file type information about the file or directory named in the nth string in list.

The following code shows the file type record.

typedef struct {

int32 flags;

int32 type;

} FileType;

Only the least significant four bits of flags contain useful information. The remaining bits are reserved for use by LabVIEW. You can test these four bits using the following four masks:

#define kIsFile 0x01

#define kRecognizedType 0x02

#define kIsLink 0x04

#define kFIsInvisible 0x08

The kIsFile bit is set if the item described by the file type record is a file. Otherwise, kIsFile is clear. The kRecognizedType bit is set if the item described is a file for which you can determine a 4-character file type. Otherwise, kRecognizedType is clear. The kIsLink bit is set if the item described is a Linux link or Mac OS X alias. Otherwise, kIsLink is clear. The kFIsInvisible bit is set if the item described does not appear in a file dialog box. Otherwise, kFIsInvisible is clear.

The value of type is defined only if the kRecognizedType bit is set in flags. In this case, type is the 4-character file type of the file described by the file type record. This 4-character file type is provided by the file system on Mac OS X and is computed by examining the filename extension on other systems.

Return Value

MgErr, which can contain the following errors. If you receive errors from LabVIEW Manager functions, most error names correspond to LabVIEW error codes.

Value Corresponding Error Code or Description
noErrNo error.
mgArgErr1
mFullErr2
fIOErr6
fNotFound7
fNoPerm8