DKTruncate

Demonstrates how to truncate a file.

Remarks

This example illustrates how to truncate a file to 500 bytes.

Code

 local integer size, integer new_size
 local string Parm, temp_file
 local integer fid

 temp_file = "testfile.dat"
 Delete temp_file noerror

 Call CopyFile( GetPCIHOME() + "\pro\PRM.PRM", "testfile.dat")
 fid= DKOpen ("testfile.dat")

 size = DKSize( temp_file )
 print "Start: Size is: ", size

 call DKTruncate( temp_file, 500 ) 
 
 size = DKSize( temp_file )
 print "Size: ", size
 call DKClose(fid)

Output

Start: Size is 309760Size: 500

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