⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tnoseek.c

📁 su 的源代码库
💻 C
字号:
/* Copyright (c) Colorado School of Mines, 2006.*//* All rights reserved.                       */#include	"sftest.h"char*	buffer;size_t	size;size_t	count;#if __STD_CSfoff_t discseek(Sfio_t* f, Sfoff_t offset, int type, Sfdisc_t* disc)#elseSfoff_t discseek(f,offset,type,disc)Sfio_t*		f;Sfoff_t		offset;int		type;Sfdisc_t*	disc;#endif{	return 0;}#if __STD_Cssize_t discwrite(Sfio_t* f, const Void_t* s, size_t n, Sfdisc_t* disc)#elsessize_t discwrite(f,s,n,disc)Sfio_t*		f;Void_t*		s;size_t		n;Sfdisc_t*	disc;#endif{	buffer = (char*)s;	size = n;	count += 1;	return n;}Sfdisc_t seekable = { (Sfread_f)0, discwrite, discseek, (Sfexcept_f)0 };MAIN(){	char	buf[1024];	sfsetbuf(sfstdout,buf,sizeof(buf));	sfset(sfstdout,SF_LINE,0);	if(sfdisc(sfstdout,&seekable) != &seekable)		terror("Can't set discipline\n");	if(sfseek(sfstdout,(Sfoff_t)0,0) < 0)		terror("Sfstdout should be seekable\n");	if(sfwrite(sfstdout,"123\n",4) != 4)		terror("Can't write\n");	if(sfwrite(sfstdout,"123\n",4) != 4)		terror("Can't write\n");	if(sfdisc(sfstdout,NIL(Sfdisc_t*)) != &seekable)		terror("Can't pop discipline\n");	if(buffer != buf || size != 8 || count != 1)		terror("Wrong calls to write\n");	TSTEXIT(0);}

⌨️ 快捷键说明

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