当前位置:网站首页>Stderr and stdout related standard outputs and other C system APIs
Stderr and stdout related standard outputs and other C system APIs
2022-06-25 14:59:00 【qq_ twenty-three million nine hundred and fifty-three thousand 】
1,stderr and stdout Is a combination of fprintf The use of
2, Using examples , The executable program is assumed to be my.exe
int main()
{
fprintf(stderr, "err!\n");
fprintf(stdout, "out!\n");
return 0;
}
// Hypothetical operation ./my.exe, Then the print on the screen is
err!
out!
// Hypothetical operation ./my.exe >1.tx, Redirect output to 1.txt, Then the print on the screen is
err!
//1.txt The content of the file is
out!
in summary stdout Can be printed to a file , and stderr Can only be printed to the screen
3,fprintf You can write directly to the file
FILE *fp = fopen(“log.log”, rw);
fprintf(fp,“test !!!\n”);
The output is printed directly to log.log In file
4,atexit
The input parameter is a no return value , Functions without input values , The function prototype
int atexit(void (**)(void) )
exit transfer ⽤ end ⽌ The order of processing functions and atexit Reverse order of registration , Register the function first and then execute
5,signal function
Specifies that the current process monitors a semaphore , The function prototype
void(* signal(int sig,void(* func)(int)))(int);
void mu_proc(int s)
{
if(SIGINT == s)
printf("get signal SIGINT\r\n");
}
signal(SIGINT, my_proc);
SIGINT from Interrupt Key produce , Usually CTRL+C perhaps DELETE. Send to all ForeGround Group The process of
边栏推荐
- High precision addition
- 1090.Phone List
- 挖财是正规的吗?股票开户安全吗?
- Gif动画怎么在线制作?快试试这款gif在线制作工具
- 2022年广东高考分数线出炉,一个几家欢喜几家愁
- Application of TSDB in civil aircraft industry
- JS select all exercise
- Why should the coroutine be set to non blocking IO
- [deep learning] multi task learning of multiple datasets data sets missing labels
- How to cut the size of a moving picture? Try this online photo cropping tool
猜你喜欢

定位position(5种方式)

【Try to Hack】vulhub靶场搭建

SPARQL learning notes of query, an rrdf query language

C language escape character and its meaning

Custom structure type

Open a restaurant

QQ情话糖果情话内容获取并保存

90 后眼中的理想 L9:最简单的产品哲学,造最猛的爆款 | 指南斟

JGG | overview of duhuilong group of Hebei University Research on plant pan genomics

有哪个瞬间让你觉得这个世界出bug了?
随机推荐
Kubernetes understands kubectl/ debugging
Introduction to flexible array
Where is it safe to open an account for buying funds? Ask for guidance
Gif动画怎么在线制作?快试试这款gif在线制作工具
Clinical chemistry | zhangjianzhong / Xu Jian develop single cell precision diagnosis and treatment technology for Helicobacter pylori
Biscuit distribution
Usage of qlist
(translation) json-rpc 2.0 specification (Chinese version)
分饼干问题
Qmake uses toplevel or topbuilddir
14 -- 验证回文字符串 Ⅱ
QT inline dialog
买卖股票的最佳时机
Sequential programming 1
JS select all exercise
Luogu p5707 [deep foundation 2. example 12] late for school
Judging the number of leap years from 1 to N years
JS to add elements to the header, or tail of an array
成员变量与局部变量的区别
Vs2019 scanf error