topen.c

来自「su 的源代码库」· C语言 代码 · 共 38 行

C
38
字号
/* Copyright (c) Colorado School of Mines, 2006.*//* All rights reserved.                       */#include	"sftest.h"MAIN(){	Sfio_t*	f;	Sfio_t	sf;	if(sfopen(sfstdout,"abc","s") != sfstdout)		terror("Bad reopening of sfstdout\n");	if(sfopen(sfstdin,"123","s") != sfstdin)		terror("Bad reopening of sfstdin\n");	sfclose(sfstdin);	if(!(f = sfopen(NIL(Sfio_t*),"123","s")) )		terror("Opening a stream\n");	sfclose(f);	if(sfopen(f,"123","s") != NIL(Sfio_t*))		terror("can't reopen a closed stream!\n");	if(sfnew(&sf,NIL(char*),(size_t)SF_UNBOUND,0,SF_EOF|SF_READ) != &sf)		terror("Did not open sf\n");	sfset(&sf,SF_STATIC,1);	if(sfclose(&sf) < 0 || !(sfset(&sf,0,0)&SF_STATIC))		terror("Did not close sf\n");	/* test for exclusive opens */	unlink(tstfile(0));	if(!(f = sfopen(NIL(Sfio_t*),tstfile(0),"wx") ) )		terror("sfopen failed\n");	if((f = sfopen(f,tstfile(0),"wx") ) )		terror("sfopen should not succeed here\n");	TSTEXIT(0);}

⌨️ 快捷键说明

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