Step 11: Free all resources

<< Click to Display Table of Contents >>

Navigation:  Application development > Introduction to BDE programming > BDE Programming in Borland C/C++ > Basic procedure >

Step 11: Free all resources

Previous pageReturn to chapter overviewNext page

After all desired operations have been performed, you need to clean up the resources allocated on behalf of the application. In addition to any memory explicitly allocated by the application, using malloc or new, all engine objects must also be cleaned up, including the cursor, database, and engine:

 

if (pRecBuf != NULL)

   free(pRecBuf);                                                // Free the record buffer

 

if (hCur != 0)

   Chk(DbiCloseCursor(&hCur));                // Close the cursor

 

if (hDb != 0)

   Chk(DbiCloseDatabase(&hDb));                // Close the database

 

DbiExit();                                                                                // Close the BDE.