Printf is not working in C signal handler

前端 未结 2 1686
长情又很酷
长情又很酷 2020-11-28 15:12

Code in question first (minimized case):

#include 
#include 

int counter = 0;

void react_to_signal(int n) {
    fprintf(stde         


        
2条回答
  •  悲&欢浪女
    2020-11-28 16:12

    You may need to fflush stderr to get the message to write before the program exits.

提交回复
热议问题