[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
USAGE
signed int scdckfind(
signed int handle,
void *key,
signed long *recno,
signed int method );
PROTOTYPE IN
sc_base.h
DESCRIPTION
scdckfind supports two key search methods (determined by method):
SC_EXACT - find an exact match with key and recno, and
SC_FIRST - find the first logical occurrence of key in the index
and return the associated record number recno if found.
If a match cannot be found, the current key will be the physical key which
would immediately precede key. The current key's value and data record
number will be returned in key and recno.
NOTES
The user must ensure that the buffer used to return the key is large
enough to hold the entire key. The maximum length of the key can be
determined via a call to scdcinfo.
When searching it is not necessary to pad the key string to size with
spaces (" "), the function will automatically do this for you.
Searching for partial keys can be accomplished by using the SC_FIRST
method. For example, you are using a fifteen character key and you want to
find the first entry where the first five characters are "ABCDE". All you
need do is copy that five character ASCIIZ string into your key buffer and
then call scdckfind. The function will space pad to length and then
find the first matching entry.
All keys are returned as strings.
EXAMPLE
#include <stdio.h>
#include <string.h>
#include <softc.h>
#include <sc_base.h>
void main()
{
int ntx;
char key[65];
long recno;
scdinit(20,0);
if (scdcopenx(&ntx, "TOCNAME.NTX", SC_BUFFER) == SC_SUCCESS) {
strcpy(key,"ABCDE.XYZ");
recno = 7L;
if (scdckfind(ntx,key,&recno,SC_FIRST) != SC_SUCCESS)
printf("%s\n",scemsg());
else
printf("%s %ld\n",key,recno);
scdcclose(ntx);
}
scdterm();
}
See Also:
scdcinfo
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson