与exit()和_exit()不同的输出? [英] different output with exit() and _exit()?

查看:117
本文介绍了与exit()和_exit()不同的输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么显示不同的输出?有人可以深入解释我吗?

why it showing different output???can anyone explain me in depth.

1.

#include <stdlib.h>
 #include <stdio.h>

int main (void)
{
printf ("Using exit ... \ n");
printf ("This is the content in buffer");
exit (0);
}

输出:

使用出口... 这是缓冲区中的内容

Using exit ... This is the content in buffer

2.

# Include <unistd.h>
# Include <stdio.h>

int main (void)
{
printf ("Using exit ... \ n");
printf ("This is the content in buffer");
_exit (0);
}

仅输出:

正在使用退出...

推荐答案

如果我们阅读_exit()的文档,则请注意:

If we read _exit()'s documentation, we note:

导致正常程序终止发生而没有完全清除资源.

Causes normal program termination to occur without completely cleaning the resources.

这大概包括刷新标准输出.

This presumably would include flushing stdout.

这篇关于与exit()和_exit()不同的输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆