📄 tatexit.c
字号:
/* Copyright (c) Colorado School of Mines, 2006.*//* All rights reserved. */#include "sftest.h"/* test to see if files created in atexit functions work ok */void ae(){ Sfio_t* f = sfopen(NIL(Sfio_t*), tstfile(0), "w"); if(!f) terror("Can't create file"); if(sfwrite(f,"1234\n",5) != 5) terror("Can't write to file");}MAIN(){ Sfio_t* f; if(argc <= 1) /* atexit function registered after some sfio access */ { if(!(f = sfopen(NIL(Sfio_t*), tstfile(1), "w")) ) terror("Can't create file"); if(sfwrite(f,"1234\n",5) != 5) terror("Can't write to file"); atexit(ae); system(sfprints("%s 1",argv[0])); } else /* atexit function registered before some sfio access */ { atexit(ae); if(!(f = sfopen(NIL(Sfio_t*), tstfile(1), "w")) ) terror("Can't create file"); if(sfwrite(f,"1234\n",5) != 5) terror("Can't write to file"); } TSTEXIT(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -