KeyView 23.3

# fpExtractSubFile()

This function extracts a subfile from a container file to a user-defined path or output stream. This call returns file format information when file is extracted to a path.

## Syntax

    int (pascal *fpExtractSubFile)  (
    	            void                          *pFile,
    		    KVExtractSubFileArg            extractArg,
    		    KVSubFileExtractInfo          *extractInfo);

## Arguments

`pFile` | The identifier of the file. This is a file handle returned from fpOpenFile().
`extractArg` | A pointer to the structure KVExtractSubFileArg, which defines the subfile to be extracted. Before you initialize the `KVExtractSubFileArg` structure, use the macro `KVStructInit` to initialize the `KVStructHead` structure.
`extractInfo` | A pointer to the structure `KVSubFileExtractInfo`, which defines information about the extracted subfile.

## Returns

- If the subfile is extracted from the container file, the return value is `KVERR_Success`.
- If the subfile is not extracted from the container file, the return value is an error code.

## Discussion

- After the file is extracted, call fpFreeStruct() to free the memory allocated by this function.

- If the subfile is embedded in the main file as a link and is stored externally, `extractInfo->infoFlag` is set to `KVSubFileExtractInfoFlag_External`.

  For example, the subfile might be an object that was embedded in a Word document by using "Link to File," or an attachment that is referenced in an MBX message. This type of subfile cannot be extracted. You must write code to access the subfile based on the path in the member `extractInfo->filePath` or `extractInfo->fileName`. See KVSubFileExtractInfo.

## Example

    KVSubFileExtractInfo   extractInfo = NULL;

    KVStructInit(&extractArg);

    extractArg.index = index;
    extractArg.extractionFlag = KVExtractionFlag_CreateDir | KVExtractionFlag_Overwrite;
    extractArg.filePath = subFileInfo->subFileName;

    /*Extract this subfile*/
    error=extractInterface->fpExtractSubFile(pFile,&extractArg,&extractInfo);
    if ( error )
    {
       extractInterface->fpFreeStruct(pFile,extractInfo);
       subFileInfo = NULL;
    }

Copyright 2016-2023 Open Text
Version 23.3 | Last updated June 2023

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 swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL KeyView 23.3

Topic Title: fpExtractSubFile()