MpatRead()函数

Synopsis

Read a pattern matching model from an open file.

Format

MIL_ID MpatRead(SystemId, FileHandle, ModelIdPtr)

MIL_ID SystemId System identifier
FILE* FileHandle; Model file handle
MIL_ID *ModelIdPtr; Storage location for model identifier

Description

This function reads a model (previously saved with MpatWrite) from an open file and returns an identifier to it. If the model was preprocessed before saving, you do not need to preprocess it again.

This function also restores all the model search parameters that were in effect when the model was saved.

The SystemId parameter specifies the system on which the pattern matching model resides. This parameter must be set to a valid system identifier, M_DEFAULT_HOST or M_DEFAULT. To indicate the default Host system of the current MIL application, specify M_DEFAULT_HOST.

The FileHandle parameter specifies the handle of the open file (opened with the standard C function fopen()). Before calling this function, the file pointer must be positioned just before the start of a valid pattern matching model. After the function call, the file remains open and is positioned immediately after the model.

The ModelIdPtr parameter specifies the address of the variable in which the model buffer identifier is to be written. Since the MpatRead function also returns the model buffer identifier, you can set this parameter to M_NULL. If allocation fails, M_NULL is written as the identifier.

Returned value

The returned value is the model buffer identifier. If allocation fails, M_NULL is returned.

See also

MpatWrite, MpatSave, MpatRestore

《MpatRead()函数》上有3条评论

评论已关闭。