小编Jon*_*han的帖子

fputs和循环的奇怪行为

运行以下代码时,我没有输出,但我无法解决原因.

# include <stdio.h>

int main()
{
    fputs("hello", stdout);

    while (1);

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

如果没有while循环,它可以完美地工作,但是只要我添加它就没有输出.当然它应该在开始循环之前输出?它只是在我的系统上吗?我是否需要冲洗某种缓冲区或什么?

提前致谢.

c c++ gcc loops stdout

2
推荐指数
1
解决办法
1458
查看次数

标签 统计

c ×1

c++ ×1

gcc ×1

loops ×1

stdout ×1