fpInit()
This function initializes an Export session.
Syntax
KVErrorCode pascal _export fpInit(
const char* pszKeyViewDir,
const char* pszLicense,
const char* pszIniFile,
DWORD dWord,
void** ppContext
);
Arguments
|
|
A pointer to a string that contains the path of the File Content Extraction Export directory (where the readers and the formats_e.ini file are located). This is normally the PLATFORM\bin directory. |
|
|
A pointer to a string that contains your license key, as provided by OpenText. Copy the key exactly, with no leading or trailing spaces. |
|
|
A pointer to a string that contains the full path of the Export configuration file, formats_e.ini. This file is normally stored in the directory install\PLATFORM\bin, where install is the path of the installation directory and PLATFORM is the name of the platform. |
|
|
Reserved. Must be 0. |
ppContext
|
A pointer to a context pointer for the session that you want to initialize. When you call fpInit(), the context pointer is set to the address of the new session context. |
Returns
The function returns an error code.
- When initialization is successful, the error code is
KVError_Successand the session context is stored in*ppContext. Use the*ppContextcontext pointer in future calls - it must be passed as the first argument to many of the File Extraction API and Export API functions. - When initialization is unsuccessful, the return value is an error code (see KVErrorCode for more information), and
*ppContextis set toNULL.
Discussion
-
If
pszKeyViewDirisNULL, the required components cannot be found. Ensure that it is valid. -
To ensure multi-threaded conversions are thread-safe, you must create a unique context pointer for every thread by calling
fpInit(). In addition, threads must not share context pointers, and the same context pointer must be used for all API calls in the same thread. Creating a context pointer for every thread does not affect performance because the context pointer uses minimal resources. -
When the conversion context is no longer required, terminate it by calling fpShutDown().
-
On Windows,
pszKeyViewDirandpszIniFilemust be in the local Windows code page.
Example
The following sample code is from the cnv2xml sample program:
error = (*KVXMLInt.fpInit)(".", YOUR_KEYVIEW_LICENSE, NULL, 0, &pKVXML);
if (error != KVError_Success)
{
printf("Error initializing KVXML: %d\n", error);
mpFreeLibrary(hKVXML);
return 4;
}