Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Using External Code in LabVIEW.pdf
Скачиваний:
91
Добавлен:
29.05.2015
Размер:
1.85 Mб
Скачать

Chapter 6 Function Descriptions

FIsARefNum

Bool32FIsARefNum(refNum);

Purpose

Determines whether refNum is a valid file refnum.

Parameters

Name

Type

Description

 

 

 

 

 

 

refNum

LVRefNum

File refnum you want to verify.

 

 

 

Return Value

Bool32, which can contain the following values:

TRUE

File refnum has been created and not yet disposed.

FALSE

File refnum is not valid.

Using External Code in LabVIEW

6-80

www.ni.com

Chapter 6 Function Descriptions

FIsEmptyPath

Bool32 FIsEmptyPath(path);

Purpose

Determines whether path is a valid empty path.

Parameters

Name

Type

Description

 

 

 

 

 

 

path

Path

Path you want to verify.

 

 

 

Return Value

Bool32, which can contain the following values:

TRUE

Path is well formed and empty and type is absolute or relative.

FALSE

Path is not a valid empty path.

© National Instruments Corporation

6-81

Using External Code in LabVIEW

Chapter 6 Function Descriptions

FListDir

MgErr FListDir(path, list, typeH);

Purpose

Determines the contents of a directory.

The function fills the AZ handle passed in list with a CPStr, where the cnt field specifies the number of concatenated Pascal strings that follow in the str[] field. Refer to the Basic Data Types section in Chapter 4, Programming Issues for CINs, for a description of the CPStr data type. If typeH is not NULL, the function fills the AZ handle passed in typeH with the file type information for each file name or directory name stored in list.

Parameters

Name

Type

Description

 

 

 

 

 

 

path

Path

Path of the directory whose contents you

 

 

want to determine.

 

 

 

list

CPStrHandle

Application zone 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

Application zone 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 file type record is:

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

Using External Code in LabVIEW

6-82

www.ni.com

The directory was not found.
Access was denied; the file, directory, or disk is locked or protected.
Insufficient memory. Unspecified I/O error.
A bad argument was passed to the function. Verify the path.

Chapter 6 Function Descriptions

#define kIsLink 0x04

#define kFIsInvisible 0x08

The kIsFile bit is set if the item described by the file type record is a file; otherwise, it 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, it is clear. The kIsLink bit is set if the item described is a UNIX link or Macintosh alias; otherwise, it is clear. The kFIsInvisible bit is set if the item described does not appear in a file dialog; otherwise, it 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 in Macintosh and is computed by examining the file name extension on other systems.

Return Value

mgErr, which can contain the following errors: mgArgErr

FNotFound

FNoPerm

MFullErr fIOErr

© National Instruments Corporation

6-83

Using External Code in LabVIEW

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]