Write a datafile format definition to a host file.
RETCODE bcp_writefmt(dbproc, filename) DBPROCESS *dbproc; char *filename;
A pointer to the DBPROCESS structure that provides the connection for a particular front-end/Adaptive Server process. It contains all the information that DB-Library uses to manage communications and data between the front end and Adaptive Server.
The full directory specification of the file that contains the format definitions.
SUCCEED or FAIL.
bcp_writefmt writes a datafile format definition to a host file. The format reflects previous calls to bcp_columns and bcp_colfmt.
bcp, the bulk copy utility, copies a database table to or from a host file in a user-specified format. User-specified formats may be saved through bcp in “datafile format definition files,” which can later be used to automate the bulk copy of files that share a common format. See the Open Client and Open Server Programmer’s Supplement for more information on the bcp utility and datafile format definition files.
Format definition files are read using bcp_readfmt.
The following code fragment illustrates the use of bcp_writefmt:
bcp_init(dbproc, "mytable", "bcpdata", "bcperrs", DB_OUT);
bcp_columns(dbproc, 3);
bcp_colfmt(dbproc, 1, SYBCHAR, 0, -1, "\t", 1, 1);
bcp_colfmt(dbproc, 2, SYBCHAR, 0, -1, "\t", 1, 2);
bcp_colfmt(dbproc, 3, SYBCHAR, 0, -1, "\n", 1, 3);
bcp_writefmt(dbproc, "my_fmtfile");
bcp_exec(dbproc, &rows_copied);