Get Pattern Registration Key
Get the pattern registration key of the current seek position in the user dictionary. The length of the key is up to a maximum of 15 bytes. Typically, it is one character of kanji (2 bytes).
int mgetkey(UINT32& keysize,char* key);
Input:
UINT32& keysize; size of the key buffer
UINT32 is unsigned int
char* key; buffer to retrieve the key
Output:
UINT32& keysize; size of the retrieved key
Return value:
1.....succeeded in retrieving
0.....not found
negative number....BUFFER_OVERFLOW
The size of the key exceeds keysize. In this case, the actual key size
is assigned to keysize and returned.
Example
#include "ocrdef.h"
#include "ocrco.h"
#include "cjocrstock.h"
#include "cjocrdict98.h"
#include "errcode.h"
...
....
CJocrDict* pjocrdict = new CJocrDict;
pjocrdict->msetsystemdict("c:\\dic\\feature\\system");
pjocrdict->msetsystemdict("c:\\dic\\feature\\systemfat");
pjocrdict->msetuserdict("c:\\dic\\feature\\user");
int ret = pjocrdict->mloaddict();
if(ret < 0) {
printf("Error");
}
ret = pjocrdict->mseekhead();
if(ret < 0) {
printf("Error");
}
else if(ret == 0) {
printf("No record in the user dictionary");
}
else {
UINT32 keysize = KEYSIZE_MAX; size of the key buffer
char key[KEYSIZE_MAX]; buffer to retrieve the key
ret = pjocrdict->mgetkey(keysize,key);
if(ret < 0) {
printf("Error");
}
else {
printf("The key of the first record is %s",key);
}
}
delete pjocrdict;