seek.c
来自「一个用C编写的简单的关系数据库系统」· C语言 代码 · 共 40 行
C
40 行
void Seek(DBF * dbf_name, char * commond, FILE ** opened_fp)
{
unsigned j = 0;
int tempInt = 0;
int fushu = FALSE;
commond = strtok(commond," ");
commond = strtok(NULL," ");
if (commond == NULL)
{
puts(" 请输入偏移值");
return;
}
if (commond[j] == '-')
{
fushu = TRUE;
j++;
}
for (;j<strlen(commond); j++)
{
if (!isdigit(commond[j]))
{
printf(" 输入错误,%s 改为整型\n",commond);
return;
}
tempInt = tempInt * 10 + (int)commond[j] - 48;
}
if (fushu)
tempInt = 0 - tempInt;
if (dbf_name->dhRecNO + tempInt < 0)
dbf_name->dhRecNO = 0;
else if (dbf_name->dhRecNO + tempInt >= dbf_name->dhRecCount)
dbf_name->dhRecNO = dbf_name->dhRecCount - 1;
else
dbf_name->dhRecNO = dbf_name->dhRecNO + tempInt;
return;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?