File Content Extraction 25.3
Filter SDK C Programming Guide

# fpOpenSubFile()

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-2025 Open Text
Version 25.3 | Last updated July 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.3

Topic Title: fpOpenSubFile()