使用 WB B 树时找不到 blkio.c

Can not find blkio.c while using WB B-tree

我按照官方指南安装了WB B-Tree。过程进行得很顺利,但是当我 运行 测试时,我收到以下错误:

blkio.c: 190: No such file or directory
unable to open database!
blkio.c: 283: Bad file descriptor
>>>>ERROR<<<<  couldn't read blk 0 (read -1 B)
blkio.c: 218: Bad file descriptor

这是我的代码:

#include <stdio.h>
#include <wb/wbsys.h>


typedef unsigned char uchar;
typedef int bool;
#define true 1
#define false 0


int main(int argc, char *argv[])
{
    init_wb(75, 150, 4096);
    HAND* handle; //B-Tree handle

    //open existing database
    SEGD *db = open_seg("/tmp/btree.db", true);
    if (db == false)
    {
        printf("unable to open database!\n");
        exit(1);
    }
}

为什么会出现这样的错误?

好吧,如果非要我猜的话,我会说这是因为您尝试打开的文件不存在 - 错误消息中就是这么说的:-)

也许您可能想使用 make_seg 而不是 open_seg。前者用于创建 文件而不是打开现有文件。

而且,为了避免混淆(由问题标题表示),它不是在尝试查找 C 源文件,几乎可以肯定这只是包含尝试读取文件的失败调用的文件和行。