File Content Extraction 25.2
Filter SDK C Programming Guide

# 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;

Copyright 1997-2025 Open Text
Version 25.2 | Last updated April 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: File Content Extraction 25.2

Topic Title: fpCloseFile()