Occasional Incomplete Output - Why?


#1

Working through the example in Xcode 4.3.3 around Figure 2.15

My output sometimes has its output truncated. It almost looks like a buffer isn’t flushed.

My output looks like this:

2012-06-24 15:54:27.844 RandomPossesions[6871:403] Rusty Spork (8Q2U8): Worth $73, recorded on 2012-06-24 19:54:27 +0000
2012-06-24 15:54:27.845 RandomPossesions[6871:403] Shiny Spork (5Y2V3): Worth $40, recorded on 2012-06-24 19:54:27 +0000
2012-06-24 15:54:27.845 RandomPossesions[6871:403] Rusty Spork (2F9Z7): Worth $40, recorded on 2012-06-24 19:54:27 +0000
2012-06-24 15:54:27.846 RandomPossesions[6871:403] Rusty Bear (8G5V6): Worth $99, recorded on 2012-06-24 19:54:27 +0000
2012-06-24 15:54:27.846 RandomPossesions[6871:403] Shiny Spork (3P9B1): Worth $10, recorded on 2012-06-24 19:54:27 +0000
2012-06-24 15:54:27.847 RandomPossesions[6871:403] Rusty Mac (6R5C1): Worth $93, recorded on 2012-06-24 19:54:27 +0000
2012-06-24 15:54:27.847 RandomPossesions[6871:403] Fluffy Spork (3E4O0): Worth $1, recorded on 2012-06-24 19:54:27 +0000
2012-06-24 15:54:27.847 RandomPossesions[6871:403] Fluffy Mac (3A6T4): Worth $30, recorded on 2012-06-24 19:54:27 +0000
2012-06-24 15:54:27.848 RandomPossesions[6871:403] Shiny Spork (8S3I1): Worth $77, recorded on 2012-06-24 19:54:27 +0000
2012-06-24 15:54:27.848 RandomPossesions[6871:403] Rusty Spo

Yes, the output is cut off in the middle of a Rusty Spork!

Even in the beginning examples I sometimes saw:

2012-06-24 13:09:54.747 RandomPossesions[5158:403] Zero
2012-06-24 13:09:54.753 RandomPossesions[5158:403] One

Missing the remaining parts of the list. I changed the code to add some white space and re-built and got the expected result.

I’m confused. Why isn’t the result printing?

lnical.


#2

See: viewtopic.php?f=149&t=4644


#3

So it is a buffer not being flushed. Thanks for the help. I added a fflush and haven’t seen the error since.

lnical.