2

I made a C program that prints out a lot of values from a binary file. I believe the program finishes it's functions and ends before it actually displays values it spits out. So as a result I get a lovely RUN SUCCESSFUL (total time: 198ms) plopped right in the middle of my nicely formatted output, successfully screwing with the continuity of the rest. Is there a non-intrusive way to fix this?

I have tried a while loop encasing main's return value with a scanf() to pause the program until the user enters any value other than 0 but I'd prefer it if I could just have it run like a 'normal' program which in this case is without any user input. Thanks in advance for any advice or tips. :)

4

1 回答 1

2

Jesse Good 是对的,这曾经是 NetBeans 中的一个错误。因此,您可以尝试以下方法:

a) 检查是否刷新缓冲区,即,如果您使用 printf(),输出在实际写入控制台之前被缓冲。尝试使用fflush(stdout);之前return。(但我想不是这样。实际上缓冲区应该在返回之前自动刷新,所以我认为这不会解决它,但你永远不知道 :-))

b) 检查您是否拥有最新版本(v7.3,2013-02-21),因为该错误已在 Nightly Build 2012-09-21 中修复。也许甚至 v7.2.1, 2012-10-22 就足够了,但 v7.2 绝对不是。

-汉内斯

于 2013-04-25T04:53:03.950 回答