Open topic with navigation

# 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 returned from `fpInit()`.
`openArg` | A pointer to the`` KVOpenFileArg structure. 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` is `NULL`.

## Discussion

Call fpCloseFile() to free the memory allocated by this function.

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

© 2006-2018 EntIT Software LLC, a Micro Focus company | Send documentation feedback to Micro Focus Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm