Preparing the Array Buffer with Data

From InterBase

Go Up to Writing Data to an Array


Create an array buffer to hold the data to be written to the array. Make it large enough to hold all the elements in the slice to be written (which could be the entire array). For example, the following declares an array buffer large enough to hold 4 long elements:

long hcnt[4];
  1. Create a variable specifying the length of the array buffer:
    short len;
    len = sizeof(hcnt);
    
  2. Fill the array buffer with the data to be written.
    If you are creating a new array, then fill the buffer with data. For
    example,
    hcnt[0] = 4;
    hcnt[1] = 5;
    hcnt[2] = 6;
    hcnt[3] = 6;
    
    To modify existing array data instead of creating a new one, then perform all the steps listed in Reading Data from an Array to read the existing array data into the array buffer. Modify the data in the buffer.

Advance To: