# Introduction

The C++ sample programs demonstrate basic usage of the C++ implementation of the Filter API. The sample code is intended to provide a starting point for your own more advanced applications or to be used for reference purposes.

The sample programs share a single header, to assist with parsing command-line arguments.

The source code for the programs is in the directory `cppapi\samples\src`.

The executable for the programs is in the directory `install\KeyviewFilterSDK\OS\bin`, where `OS` is the name of the operating system.

## Build the Sample Programs

NOTE: To build the sample programs on Windows, you need at least Microsoft Visual Studio 2015.

To build the sample programs on Windows

1. At the Visual Studio command prompt, switch to the `cppapi/samples/bin/` directory and run the following command:

   `nmake -f Makefile`

   The sample programs are created in the `bin` directory.

To build the sample programs on Linux

1. Switch to the `cppapi/samples/bin` directory.

2. Run the appropriate command:

   GCC 5

   `export CXXFLAGS="-std=c++11"
   make`

   GCC 6

   `make`

   The sample programs are created in the `bin` directory.

## Run the Sample Programs

You can run a sample program with no arguments to view command-line help. For example:

    cppapi/samples/bin$ ./detect
    Basic usage: ./detect [options] input_file

    Options:
    --bin_path <path>    Path to FilterSDK bin directory
    --tmp_dir <path>     Path to temporary directory

    Boolean Options:
    --ip                 Run in process
    --oop_log            Create out-of-process log
    --oop_log_mem        Add memory error information to the out-of-process log

All the sample programs have options that take a required value, and Boolean options that toggle behavior. The programs contain simple argument parsing logic to detect invalid usage.

You must provide each sample program with the path to the Filter SDK `bin` directory where the KeyView dynamic libraries are stored. If you specify the `bin` directory incorrectly, the sample program prints a message indicating that the `kvfilter` library could not be loaded. The `bin_path` argument defaults to the current directory.

The following C++ sample programs are provided:

- detect
- extract
- filter_container
- filter_document
- metadata
- subfiles

© Copyright 2016-2020 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm