rewind.c

来自「APUE(第二版)的随书源代码,与第一版的代码相比增加了一些章节的代码(详见第二」· C语言 代码 · 共 22 行

C
22
字号
#include	"db.h"/* Rewind the index file for db_nextrec(). * Automatically called by db_open(). * Must be called before first db_nextrec(). */voiddb_rewind(DB *db){	off_t	offset;	offset = (db->nhash + 1) * PTR_SZ;		/* +1 for free list ptr */		/* We're just setting the file offset for this process		   to the start of the index records; no need to lock.		   +1 below for newline at end of hash table. */	if ( (db->idxoff = lseek(db->idxfd, offset+1, SEEK_SET)) == -1)		err_dump("lseek error");}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?