sx_CopyFile

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_CopyFile

VB Declaration

Declare Function sx_CopyFile Lib "Apollo9.dll"

(ByVal cpToFileName As String)

As Integer

C Declaration

BOOL FAR PASCAL sx_CopyFile

(BYTEP cpToFileName);

Description

Copies the current data table to another file. Any filters in use on the source file and the setting of sx_SetDeleted are respected. The records are copied in the order of the current index in use. If memos are attached to the source table, a memo file is created and memos are copied as well.

WARNING: If a file exists with the same name as the target table, it is overwritten without warning.

The progress of the function may be visually monitored if a gauge hook has been set with sx_SetGaugeHook.

Parameters

cpToFileName: The name of the target table including full path and extension information if desired. The default extension is DBF. If a memo file must be created, the SDENTX driver will create a file of the same name with an extension of DBT. The extensions for the SDEFOX and SDENSX drivers are FPT and SMT respectively.

Return Value

True or False depending upon the outcome of the operation.

VB Example

' build a test subset of a master database

If Dir$("c:\vb\cust.dbf") = "" Then

MsgBox "No File"

End

End If

 

CustArea = sx_Use("\vb\cust.dbf", "cust", READWRITE, SDENTX)

sx_SetFilter "upper(trim(place))='CHINA' .and. left(last, 1)>' '"

sx_GoTop

iRet = sx_CopyFile("c:\vb\test.dbf")

sx_CloseAll

CustArea = sx_Use("\vb\test.dbf", "cust", READWRITE, SDENTX)

n1 = sx_Index("\vb\t1.ntx", "customer", 0, 0, 0&)

sx_Close

C Example

void CNamesForm::OnButtonAppendBatch()

{

// save master before append

sx_CopyFile("c:\\back\\sqmback.dbf");

 

if (!sx_AppendFrom("c:\\vb\\sxqueue.dbf", SDENTX, NULL))

{

// on failure, restore master

AfxMessageBox((LPCSTR) "Batch append failed.");

sx_Close();

sx_Use("c:\\back\\sqmback.dbf", "qback", READONLY, SDENTX);

sx_CopyFile("c:\\vb\\sqmast.dbf");

sx_Use("c:\\vb\\sqmast.dbf", "qmaster", READWRITE, SDENTX);

}

else

sx_GoTop();

}

See Also

sx_CopyFileText, sx_AppendFrom, sx_CopyStructure, sx_SetGaugeHook