With CPDB you can browse your databases in any direction, with very simple functions.
To browse your database simply use this example :
// Read the first record
err = CPDB_ReadFirst(mydbHandle);
while (err == 0)
// Work on the record here
// Go to the next record
err = CPDB_ReadNext(mydbHandle);
The loop will end when CPDB_ReadNext return an error, you must verify this error, it must be a CPDB_ERR_EOF error. You can browse in the inverse direction by using CPDB_ReadLast and CPDB_ReadPrevious functions, the error will be CPDB_ERR_BOF.
To browse page by page, use the CPDB_SeekForward and CPDB_SeekBackward functions. This example seek 10 records in one operation :
err = CPDB_SeekForward(mydbHandle, 10);
Note ; if the end (or begin) of the file is reached, the read operation is canceled, you must do a CPDB_ReadFirst (or Last) to complete the operation.
A any time it is possible to know if the last browse operation have succeded, use the CPDB_IsOut function :
Boolean boolIsOut; err = CPDB_IsOut(iHandle, &boolIsOut);
If boolIsOut contain true, the last browse operation have failed, and no record is currently readed.
Creation date : 01/10/2003 @ 06:20
Last update : 01/10/2003 @ 07:24
Category : CPDB library
Page read 6787 times