writeptr.c

来自「用C语言编的邮件系统(毕业论文)」· C语言 代码 · 共 21 行

C
21
字号
#include	"mail.h"/* Write a chain ptr field somewhere in the index file: * the free list, the hash table, or in an index record. */void_mail_writeptr(MAIL *mail, off_t offset, off_t ptrval){	char	asciiptr[PTR_SZ + 1];	if (ptrval < 0 || ptrval > PTR_MAX)		err_quit("invalid ptr: %d", ptrval);	sprintf(asciiptr, "%*d", PTR_SZ, ptrval);	if (lseek(mail->idxfd, offset, SEEK_SET) == -1)		err_dump("lseek error to ptr field");	if (write(mail->idxfd, asciiptr, PTR_SZ) != PTR_SZ)		err_dump("write error of ptr field");}

⌨️ 快捷键说明

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