Appendix B C API Code Samples

prevnext

Report All Files


Description

This example prints the (long) name of each analyzed file in the project. The long name of a file is the full path of the file.

Sample Code

 1	 static void reportAllFiles() {
 2	  UdbEntity  *fileEnts;        
 3	  int        fileEntsSize;    
 4	  int       i;
 5	 
 6	    udbListFile (&fileEnts, &fileEntsSize);   
 7	    printf ("\nProject Files:\n");
 8	    for (i=0; i<fileEntsSize; i++)
 9	       printf (" %s \n", udbEntityNameLong(fileEnts[i]) );
 10	    udbListEntityFree(fileEnts);
 11	 }

Explanation of Sample Code

line 2-3: Declare variables for the list of entities and the list size.

line 5: Retrieve the list of analyzed file entities.

line 6: Print a header message.

line 7: Loop through all the file entities in the list.

line 8: Print the long name, which is the full path, of the file entity. Alternatively, the short name could be printed, which would show only the file name and not the full path.

line 9: Free the file entity list when done.

Sample Output

 Project Files:
    D:\examples\cpp\Paintlib\code\src\stdpch.h
    D:\examples\cpp\Paintlib\code\src\bitmap.h
    D:\examples\cpp\Paintlib\code\src\datasrc.h
    D:\examples\cpp\Paintlib\code\src\picdec.h
    D:\examples\cpp\Paintlib\code\src\config.h
    D:\examples\cpp\Paintlib\code\src\tga.h
    D:\examples\cpp\Paintlib\code\djgpp\testdec\testdec.cpp
    D:\examples\cpp\Paintlib\code\src\anybmp.cpp

prevnext


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