This is basically two functions (plus supporting infrastructure):
_Xbase_ReadToArray($filename, Byref $array, [...])
_Xbase_WriteFromArray($filename, Byref $array, [...])
that transfer all data from one container to the other. Various optional formatting parameters are detailed in the Remarks section of the script; a small test script plus dbf test file (the latter from the (free) Harbour distribution, see here) are provided for your entertainment. Note that the $array variable has to exist already, as it's parsed ByRef, but it does not have to have the correct dimensions.