I'm using Pervasive SQL 9, in Transactional mode/engine. Usually, when I need to copy records from one data file to other, I use butil.exe utility from command prompt, in this way:
butil -copy fsource.dat ftarget.dat
This work great, but I need to know if that can be done programmatically, through a pervasive DLL/API.
There is nothing native that can do what you want.
It can be written into your application fairly easily. The steps are Clone the original file, open both files, read the records in the original file, write to the new file, once done, close both files.
You could also have it written or use a third party tool like my Btrieve Rebuild DLL (Mirtheil Software ). It's geared to rebuilding files but can do what you are looking for.
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.