开发者

C++ microkernel cout problem

Ok, I'm working on my Operating Systems assignment. I need to write a microkernel which is able to do some basic stuff with threads, semaphores, events, etc. BCC 3.1 is imitating my system environment. Classical debugging is really not of use. I'm debugging in cout style. Problem is weird behavior of cout. It writes out in blocks or something. If I do, like, 40 couts it writes everything out. If I do 39 of them, it doesn't write any of them. On other hand if i do between 40 and 79 couts, it still writes only first 40, but if I do 80 of them, they're all ok, etc. Numbers are not exact, I'm not sure what's the number really. But I have also noticed that changing the length of string that is cout-ed effects the same way. Only I don't know how many characters equals one 开发者_如何学运维cout call. Additional information available upon request. Thanks in forward.


sounds like buffering regardless of the fact std::cout shouldn't buffer output. in any case you can try flushing cout by

std::cout.flush();

or

std::cout << std::flush;

or

std::cout << std::endl;

or even by disabling buffering:

std::cout.rdbuf()->pubsetbuf(0, 0);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜