Linux exit() and

  
/***** exit1.c ******/#include<stdio.h>#include<stdlib.h>main(){ printf("output begin /n"); printf("content in buffer"); exit(0);}

Use the exit() function to write the contents of the file buffer back to the file before ending the process. This is a safer way to exit.

The following _exit() function does not process the buffer and clears it directly before ending the process, so the risk is relatively large.


/***** exit2.c ******/#include<stdio.h>#include<unistd.h>main(){printf(" Output begin/n");printf("content in buffer");_exit(0);}Run result:


Above:

output begin content in buffer


 The following: 



output begin
Copyright © Windows knowledge All Rights Reserved