acct.c

来自「apue第二版每一章节的c语言源码」· C语言 代码 · 共 23 行

C
23
字号
#include	"lprps.h"/* Write the number of pages, hostname, and loginname to the * accounting file.  This function is called by main() at the end * (if all was OK, by printer_flushing(), and by handle_intr() if * an interrupt is received. */voiddo_acct(void){	FILE	*fp;	if (end_page > start_page &&		acct_file != NULL &&		(fp = fopen(acct_file, "a")) != NULL) {			fprintf(fp, "%7.2f %s:%s\n",			    		(double)(end_page - start_page),			    		hostname, loginname);			if (fclose(fp) == EOF)				log_sys("do_acct: fclose error");	}}

⌨️ 快捷键说明

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