File Content Extraction 26.1
XML Export SDK C Programming Guide

# fpOpenFile()

This function opens a file to make the file accessible for subfile extraction or conversion.

## Syntax

    int (pascal *fpOpenFile) (
        void                      *pContext,
        KVOpenFileArg              openArg,
        void                      **pFile);

## Arguments

`pContext` | A pointer to a session that you initialized by calling `fpInit()`.
`openArg` | A KVOpenFileArg. This structure defines the input parameters necessary to open a file for extraction, such as credentials, and the default extraction directory. Before you initialize the `KVOpenFileArg` structure, use the macro `KVStructInit` to initialize the `KVStructHead` structure.
`pFile` | A handle for the opened file. This handle is used in subsequent file extraction calls to identify the source file.

## Returns

- If the file is opened, the return value is `KVERR_Success`.

- If the file is not opened, the return value is an error code and `pFile` points to `NULL`.

## Lifetime and Memory Management

After you have finished extracting the file, call fpCloseFile() to free the memory allocated by this function. Call fpCloseFile() only when `fpOpenFile()` returns `KVError_Success`.

## Example

    KVOpenFileArgRec    openArg;

    /*Initialize the structure using KVStructInit*/
    KVStructInit(&openArg);
    openArg.extractDir = destDir;
    openArg.filePath   = srcFile;

    /*Open the main file */
    if ( (error = extractInterface->fpOpenFile(pExport,&openArg,&pFile)))
    {
       extractInterface->fpCloseFile(pFile);
       pFile = NULL;
    }

Copyright 1997-2025 Open Text
Version 26.1 | Last updated January 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.1

Topic Title: fpOpenFile()