DBReadArray and DBWriteArray

Demonstrates how to read and write a PCIDSK array segment of data.

Remarks

This exmaple illustrates how to manipulate a segment array on a PCIDSK file.

Code

  local int tfid
  local double column_coef[512], double ptr new_array
  local int i
  local int segment_num
  local  string temp_file

  for i = 1 To 512
    column_coef[i] = i
  endfor

  try
    temp_file = "./my.pix"
    delete temp_file noerror
    call CopyFile( GetPCIHOME() + "/demo/irvine.pix", \
                 temp_file)

    tfid = DBOpen(temp_file, "r+")
    segment_num = DBWriteArray(tfid, 0, column_coef, 512)

    new_array = DBReadArray(tfid, segment_num)

    for i = 1 To F$Len(new_array)
        print new_array[i]
    endfor
    call DBClose(tfid)

    call EFree( new_array )
  onerror
    print "Error: ", GetLastErrorMessage()
  endonerror

Output

 1
 2
 ...
 511
 512

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.