From b49416489c472287036574f998055fafedf5ea0f Mon Sep 17 00:00:00 2001 From: Jordan Cristiano Date: Fri, 15 May 2015 17:45:37 -0400 Subject: [PATCH] Added buffered output to stdout when using .con output --- demboyz/conlogwriter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/demboyz/conlogwriter.cpp b/demboyz/conlogwriter.cpp index f76727d..0a5eccb 100644 --- a/demboyz/conlogwriter.cpp +++ b/demboyz/conlogwriter.cpp @@ -3,7 +3,6 @@ #include "netmessages/nethandlers.h" #include "demotypes.h" #include -#include class ConLogWriter: public IDemoWriter { @@ -38,10 +37,13 @@ void ConLogWriter::StartWriting(demoheader_t& header) //ss << "Playing demo from " << << ".\n"; //fputs(ss.str().c_str(), m_outputFp); //std::clog << ss.str() << std::endl; + fflush(stdout); + setvbuf(stdout, NULL, _IOFBF, 1024*64); } void ConLogWriter::EndWriting() { + fflush(stdout); } void ConLogWriter::StartCommandPacket(CommandPacket& packet) @@ -60,6 +62,6 @@ void ConLogWriter::WriteNetPacket(NetPacket& packet) { ss << "\n"; fputs(ss.str().c_str(), m_outputFp); - std::clog << ss.str(); + fputs(ss.str().c_str(), stdout); } }