当前位置:网站首页>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
边栏推荐
- Is it safe to open a stock account online?
- What is the difference between escape, encodeuri and encodeuricomponent?
- [deep learning] multi task learning of multiple datasets data sets missing labels
- Jaspersoft studio adding MySQL database configuration
- Usage of pure virtual functions
- Common operations in VIM
- HMS core machine learning service realizes simultaneous interpretation, supports Chinese-English translation and multiple voice broadcast
- Study notes of cmake
- 15 -- 最接近原点的 K 个点
- QQ love talk candy love talk content acquisition and storage
猜你喜欢

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

User defined data type - structure

‘make_ unique’ is not a member of ‘std’

Power automatic test system nsat-8000, accurate, high-speed and reliable power test equipment

【中国海洋大学】考研初试复试资料分享

Clinical chemistry | zhangjianzhong / Xu Jian develop single cell precision diagnosis and treatment technology for Helicobacter pylori

How to crop GIF dynamic graph? Take this picture online clipping tool

Uniapp icon configuration

How to make GIF animation online? Try this GIF online production tool

What moment makes you think there is a bug in the world?
随机推荐
Biscuit distribution
QT database connection
Time stamp calculation and audio-visual synchronization of TS stream combined video by ffmpeg protocol concat
Application of TSDB in civil aircraft industry
Async await to achieve sleep waiting effect
2022年广东高考分数线出炉,一个几家欢喜几家愁
弹性布局(display:flex;)属性详解
开餐馆
【中国海洋大学】考研初试复试资料分享
Learning notes on February 8, 2022 (C language)
Go closure usage example
C language escape character and its meaning
挖财是正规的吗?股票开户安全吗?
System Verilog - data type
[HBZ sharing] use of locksupport
BM setup process
Flexible layout (display:flex;) Attribute details
[deep learning] multi label learning
Review of arrays and pointers triggered by a topic
System Verilog - thread