Click here to Skip to main content
15,881,812 members
Articles / Programming Languages / C++

Real-Time Console Output Redirection

Rate me:
Please Sign up or sign in to vote.
4.81/5 (47 votes)
31 Oct 2006Zlib7 min read 373.6K   5.1K   116  
Console process output flushing is no longer a problem with this little stub.
// DemoConsole.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <windows.h>

int main(int argc, char* argv[])
{
	for (int i = 0; i < 100; i++)
	{
		for (int j = 0; j < i; j++)
			printf(".");
		printf("%d\n", i);
		Sleep(50);
	}
	return 0;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The zlib/libpng License



Comments and Discussions