Step 7: Using these properties, allocate memory for a record buffer

<< Click to Display Table of Contents >>

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

Step 7: Using these properties, allocate memory for a record buffer

Previous pageReturn to chapter overviewNext page

You must use the properties you obtained in Step 8 in the following code to allocate memory for a record buffer:

 

pBYTE                        pRecBuf;                // Pointer to the record buffer

 

pRecBuf = (pBYTE) malloc(curProps.iRecBufSize * sizeof(BYTE));

if (pRecBuf == NULL)

{                

  // If pRecBuf is NULL, there was not enough memory to allocate

  // a record buffer.

  // Handling of this error is user-determined, but no information

  // from the table can be retrieved.  

}