fpCloseFile()

This function frees the memory allocated by fpOpenFile() and closes the file.

Syntax

int (pascal *fpCloseFile) (void *pFile);

Arguments

pFile The identifier of the file. This is a file handle returned from fpOpenFile() or fpOpenFileFromFilterSession().

Returns

  • If the file is closed, the return value is KVERR_Success.

  • If the file is not closed, the return value is an error code.

Lifetime and Memory Management

  • After you close the file, you must not use it in any further calls to the extraction API.

  • Closing the file does not close any subfiles you have opened with fpOpenSubFile(). You must close those subfiles with fpCloseSubFile() before you call fpCloseFile.

  • Closing the file does not free resources used by any of the structs that the extraction API returns (for example in fpGetMainFileInfo(), fpGetSubFileInfo(), fpGetSubFileMetaData() or fpExtractSubFile()). To free up those resources you must use fpFreeStruct() before you call fpCloseFile().

  • Closing the file does not free up the memory used for the metadata returned by fpGetSubFileMetadataList(). You must free that memory by calling KVMetadataList.fpFree() before closing the file.

  • After you close the file, you must not access any of those structs or metadata, or attempt to read from an open subfile.

Example

extractInterface->fpCloseFile(pFile);
pFile = NULL;