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 Delphi > Basic procedure >

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

Previous pageReturn to chapter overviewNext page

The next step is to make available a memory buffer for record data. A later step will read one record’s worth of data into this buffer. From there, the values of individual fields can be extracted for use. Allocate memory space for the record buffer using the Delphi function AllocMem. The size of this buffer needs to be the size of the record as indicated by the DbiGetCursorProps (in the preceding step). Use the iRecBufSize field of the CURProps structure with the AllocMem function.

var

 RecordBuffer: pBYTE; // Buffer into which to load a record

begin

 …

 RecordBuffer := AllocMem(CursorProps.iRecBufSize);

 …

end;