From: Derry B. <db...@ww...> - 2000-10-16 22:17:07
|
Don wrote: > > Hi, > > I am trying to create an NTX index file from a dBase III+ compatible file. > For some reason, the index file is created but they contain no records > (empty file). Has anyone else experienced this? My code looks like this: > > #include <xdb/xbase.h> > > /* set the stack large for dos compiles */ > #ifdef __XBDOS > #include <stdio.h> > extern unsigned _stklen = 100000; > #endif > > int main() > { > xbShort rc; > xbXBase x; > xbDbf MyFile( &x ); > #ifdef XB_INDEX_NTX > xbNtx intx1( &MyFile ); > #endif // XB_INDEX_NTX > > MyFile.OpenDatabase( "/home/ftpadmin/pub/websail.dbf" ); > > if(( rc = intx1.CreateIndex( > "/home/ftpadmin/pub/websail.ntx", "sportodis+sarrdate", XB_NOT_UNIQUE, > XB_OVERLAY )) != XB_NO_ERROR) > { > cout << "Error creating index 1 = " << rc << endl; > exit( 1 ); > } > > MyFile.CloseDatabase(); /* close database */ > return 0; > } > This will create, but not populate the index. You must call intx1.ReIndex() to fill the index. Regards, Derry Bryson |