<< Click to Display Table of Contents >> Navigation: Apollo API Listing > sx_CopyFileText |
Declare Function sx_CopyFileText Lib "Apollo9.dll"
(ByVal cpTextFileName As String
ByVal iFileType As Integer)
As Integer
BOOL FAR PASCAL sx_CopyFileText
(BYTEP cpTextFileName,
SHORT iFileType);
Copy the current data table to an ASCII text file. The text file may be formatted as either comma delimited or SDF (system data format).
In a comma delimited file, each table field is separated from the next with a comma, and all character fields have trailing spaces removed and are surrounded with quotes ("). Each text record is terminated with carriage return and line feed byte pair (CR-LF). The records are of variable length.
SDF text files contain images of each table record. Each record is a fixed length (the table record length - 1 for the deletion flag byte and plus 2 for the CR-LF pair). There are no delimiters between fields.
Notes:
• Memo field references are blank in the text output file.
• If a file with the same name exists, it is overwritten.
• The progress of the function may be visually monitored if a gauge hook has been set via sx_SetGaugeHook.
cpTextFileName: The name of the target text file including full path and extension if desired. An existing file with the same name will be overwritten.
iFileType: Use one of the following manifest constants:
COMMA_DELIM 21 Comma-Delimited Text File
SDF_FILE 22 Space-Delimited (SDF) Text File
True or False depending on the outcome of the operation.
' build a comma-delimted text subset of a master database
If Dir$("c:\vb\cust.dbf") = "" Then
MsgBox "No File"
End
End If
CustArea = sx_Use("\data\cust.dbf", "cust", READWRITE, SDEFOX)
sx_SetFilter "upper(trim(place))='CHINA' .and. left(last, 1)>' '"
sx_GoTop
iRet = sx_CopyFileText( "c:\data\customers.txt", COMMA_DELIM )
sx_CloseAll
sx_Close
// build a comma-delimted text subset of a master database
SHORT iCustArea, iRet;
iCustArea = sx_Use("\\data\\cust.dbf", "cust", READWRITE, SDEFOX);
sx_SetFilter("upper(trim(place))='CHINA' .and. left(last, 1)>' '");
sx_GoTop();
iRet = sx_CopyFileText( "c:\\data\\customers.txt", COMMA_DELIM );
sx_CloseAll();