File Content Extraction 26.3
Filter SDK C Programming Guide

# fpOpenSubFile()

DEPRECATED: The `fpOpenSubFile()` function is deprecated in File Content Extraction version 26.2 and later. OpenText recommends that you use fpOpenDocumentFromSubFile() or fpOpenFile() instead.

This function is still available for existing implementations, but it might be incompatible with new functionality and might be removed in future.

This function opens a subfile as a stream, which can be used directly or passed to other File Content Extraction interfaces.

## Syntax

    int (pascal *fpOpenSubFile) (
            void                  *pFile,
            KVExtractSubFileArg    extractArg,
            KVInputStream        **stream);

## Arguments

`pFile` | The identifier of the file. This is a file handle returned from fpOpenFile().
`extractArg` | A KVExtractSubFileArg, which defines the subfile to extract. Before you initialize the KVExtractSubFileArg structure, use the macro `KVStructInit` to initialize the `KVStructHead` structure. For this call, you do not need to set either the `filePath` or `stream` members of this structure.
`stream` | A pointer that will receive the opened input stream.

## Returns

- If the subfile is opened, the return value is `KVERR_Success`.
- If the subfile is not opened, the return value is an error code.

## Lifetime and Memory Management

After you finish using the stream, call fpCloseSubFile() to free the resources allocated for the stream. Call fpCloseSubFile() only when `fpOpenSubFile()` returns `KVError_Success`. You must call fpCloseSubFile() before you call fpCloseFile().

## Discussion

Before opening the subfile, you must get the main file information by calling fpGetMainFileInfo().

You cannot use the reader `pdf2sr` (see Use the pdf2sr Reader) when using this function to extract files to a stream.

## Example

    KVExtractSubFileArgRec extractArg = {0};
    KVInputStream stream = NULL;

    KVStructInit(&extractArg);
    extractArg.index = index;

    error = extractInterface->fpOpenSubFile(pFile, &extractArg, &stream);
    if (error)
    {
        /* Handle error here */
    }
    else
    {
        /* Use stream here */

        extractInterface->fpCloseSubFile(stream);
    }

Copyright 1997-2026 Open Text
Version 26.3 | Last updated July 2026

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 26.3

Topic Title: fpOpenSubFile()