readptr.c

来自「unix环境高级编程一书源代码 本书全面介绍了UNIX系统的程序设计界面—系统」· C语言 代码 · 共 20 行

C
20
字号
#include	"db.h"/* Read a chain ptr field from anywhere in the index file: * the free list pointer, a hash table chain ptr, or an * index record chain ptr.  */off_t_db_readptr(DB *db, off_t offset){	char	asciiptr[PTR_SZ + 1];	if (lseek(db->idxfd, offset, SEEK_SET) == -1)		err_dump("lseek error to ptr field");	if (read(db->idxfd, asciiptr, PTR_SZ) != PTR_SZ)		err_dump("read error of ptr field");	asciiptr[PTR_SZ] = 0;		/* null terminate */	return(atol(asciiptr));}

⌨️ 快捷键说明

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