Appendix B C API Code Samples

## Appendix B C API Code Samples

### C API Code Samples

This Appendix provides simple, sample code for use as examples that can also be used as a starting point for creating your own application. All examples use an Understand for C++ database. API usage with other Understand databases/languages is similar.

The following sections show each different example as a separate function within a larger module. The first section shows the common elements within a "main" function, from which any of the other example functions could be called.

Each example shows the C code, an explanation of the code, and sample output produced by the code.

This chapter contains the following:

Section Page
Open Database and Get All Entities
Report All Entities
Report All Files
Report Cyclomatic Complexity of Functions
Report Functions with their Parameters and Types
Report Global Objects
Report Project Metrics
Report All Structs and their Member Types
Find all References To and From an Entity

Scientific Toolworks, Inc. http://www.scitools.com Voice: (802) 763-2995 Fax: (802) 763-3066 support@scitools.com sales@scitools.com