campo-sirio/cb5/append.c
alex a0f5e0898b This commit was generated by cvs2svn to compensate for changes in r975,
which included commits to RCS files with non-trunk default branches.

git-svn-id: svn://10.65.10.50/trunk@976 c028cbd2-c16b-5b4b-a496-9718f37d4682
1995-02-06 15:33:45 +00:00

60 lines
1.3 KiB
C
Executable File

/***********************************************************************\
* *
* APPEND.C Copyright (C) 1993 Sequiter Software Inc. *
* *
\***********************************************************************/
/* See User's Manual, page 195 */
#include "d4all.h"
#ifdef __TURBOC__
extern unsigned _stklen = 10000;
#endif
CODE4 cb ;
DATA4 *data_from, *data_to ;
FIELD4 *info_from, *info_to ;
void main()
{
int rc1, rc2, rc ;
d4init( &cb ) ;
cb.optimize = 1 ;
cb.optimize_write = 1 ;
data_from = d4open( &cb, "FROM_DBF.DBF" ) ;
data_to = d4open( &cb, "TO_DBF.DBF" ) ;
e4exit_test( &cb ) ;
d4opt_start( &cb ) ;
info_from = d4field( data_from, "INFO" ) ;
info_to = d4field( data_to, "INFO" ) ;
cb.lock_attempts = 1 ;
rc1 = d4lock_file( data_from ) ;
rc2 = d4lock_file( data_to ) ;
if( rc1 != 0 || rc2 != 0 )
{
printf( "Locking Failed\n" ) ;
exit(0) ;
}
for( rc = d4top(data_from); rc == 0
; rc = d4skip(data_from,1) )
{
d4append_start( data_to, 0 ) ;
f4assign_field( info_to, info_from ) ;
d4append( data_to ) ;
}
d4unlock( data_from ) ;
d4unlock( data_to ) ;
d4close_all( &cb ) ;
}