DT300Hash算法使用说明
DT300编程使用说明
一. 界面显示
1.屏幕显示为18*5:
行:一行显示18个字符(相当于9个汉字);
列:一屏显示5行;
如果一行显示不下,具有自动换行的功能和Dt900一样,不需要像DT800写换行函数;
二:函数
1:casio提供的底层函数
(1)建立索引文件函数:
int iHashAssign (FILE* DataFilePointer,
FILE* IndexFilePointer,
long ll,
long lV,
long lL,
long lW1);
#include
FILE *DataFilePointer;
DataFilePointer = fopen (char* file,char* mode);
file : Name of the file with path.
mode : Mode of the file to open (“r”).
“以’r’的方式打开数据文件“
FILE *IndexFilePointer;
IndexFilePointer = fopen (char* file,char* mode);
file : Name of the file with path.
mode : Mode of the file to open (“w+”).
“以’w+’的方式打开索引数据文件“
ll : Length of the KEY field in Data file.
“关键字段在数据文件中的长度”
lV : Total number of records in Data file to be hashed.
“建立的索引文件的总容量(估计值)
lL : Length of one complete record in Data file (i.e. KEY + Data length).
“数据字段总的长度(关键字+数据)“
lW1: Total volume of Index file (excluding header information).Normally, lW1 >= lV * 1.2 at least.
“总的数据文件的总容量(估计值),最少为1V*1.2”
ll,lV,lL,lW1都是长整型数据;
0:成功;
102:不能从数据文件中读取数据;
105:数据文件无法打开;
111:不能在数据文件中查询;
202:不能读取索引文件;
203:不能写索引文件;
205:索引文件无法打开;
211:不能在索引文件中查询;
320:内存不够;
400:一个或多个真值通过主函数后无效;
(2) iHashRead函数
int iHashRead (char *pszKey,
FILE *DataFilePointer,
FILE *IndexFilePointer,
char *pszBuff);
pszKey:关键字数据;
DataFilePointer :
#include
FILE *DataFilePointer;
DataFilePointer = fopen (char* file,char* mode);
file : Name of the file with path.
mode : Mode of the file to open (“r”).
“以’r’的方式打开数据文件“
IndexFilePointer:
FILE *IndexFilePointer;
IndexFilePointer = fopen (char* file,char* mode);
file : Name of the file with path.
mode : Mode of the file to open (“r”).
“以’r’的方式打开索引数据文件“
pszBuff: 读到的记录存放的位置;
返回值:
211:不能在索引文件中搜索;
320:内存不够;
330:hash索引的关键值不存在;
331:输入的关键值是错误的;
332:输入的关键值指针是错误的;
(3)iHashWrite函数
int iHashWrite (char *pszKey,
FILE *DataFilePointer,
FILE *IndexFilePointer,
char *pszBuff)
pszKey:关键字数据;
DataFilePointer :
#include
FILE *DataFilePointer;
DataFilePointer = fopen (char* file,char* mode);
file : Name of the file with path.
mode : Mode of the file to open (“r+”).
“以’r+’的方式打开数据文件“
IndexFilePointer:
#include
FILE *IndexFilePointer;
IndexFilePointer = fopen (char* file,char* mode);
file : Name of the file with path.
mode : Mode of the file to open (“r”).
“以’r’的方式打开索引数据文件“
pszBuff::要改写的数据
返回值:
103:不能在数据文件中写数据;
333:输入的数据非法;
334:输入的数据指针非法;
(4)iHashAdd函数
int iHashAdd (char *pszKey,
FILE *DataFilePointer,
FILE *IndexFilePointer,
char *pszAppendData)
pszKey:关键字数据;
DataFilePointer :
#include
FILE *DataFilePointer;
DataFilePointer = fopen (char* file,char* mode);
file : Name of the file with path.
mode : Mode of the file to open (“r+”).
“以‘r+’的方式打开数据文件;
IndexFilePointer:
#include
FILE *IndexFilePointer;
IndexFilePointer = fopen (char* file,char* mode);
file : Name of the file with path.
mode : Mode of the file to open (“r+”).
“以‘r+’的方式打开索引数据文件;
pszAppendData: sdata:除索引字段新增加的字段;
返回值有0,103,104,105,111,202,203,205,211,320,330,331,332,333,334请参考以上;
2.DT300的新函数(请参考C:\Dt300\source\dt300.c文件)
1.Search查找函数
2.Write 写函数
3.Read 读函数
4.建立文件函数int Create_File(B *filename)
二.传输
1.程序传输
/R A:\CONFIG.HTS B:\
/R A:\ASTART.HTS B:\
/R A:\APSMP.LOD B:\ ‘程序文件‘
/R A:\PATCH001.LOD B:\ ‘补丁文件’
/R A:\FONT6SK.FON B:\ ‘字库文件’
2.数据传输
1.上传文件
/S A:\xxx.txt A:\
2.下传文件
/R A:\yyy.txt
三.现在的DT300无法读取邮政25码
四.通讯函数现在还没有实现;