Where did my cuda printf output go?

I put a printf statement into my cuda kernel.

It output way too much stuff for my console window. So I used freopen to map stdout to a file.

But now, the console window does NOT have the cuda printf output; neither does the file I redirected stdout to (it has other stuff from my app)

Where did the cuda printf output go?

Why don’t you use terminal redirection instead of freopen? It is much simpler, more flexible and probably works better:

MyProgram > output.txt

Squisher: thanks for the reply but way too cryptic for me to understand. where? how? I am running VS2010 under Win 7. cant find “terminal redirection” anywhere. can you give more detailed response ?

Has anybody resolved this? Squisher’s answer is fine, but I would like more control than that – for example, I would like different kernels to output to different files. Like jm@imagemining.net, I am using VS2010, Win7, and my printf output goes into the ether when using freopen.

__global__ void printfTst()
	printf("This is the Kernel Output");

void main()
	printf ("CPU output before redirection.");
	freopen ("d:myfileStdOut.txt","w",stdout);
	freopen ("d:myfileStdErr.txt","w",stderr);
	printf ("CPU output redirected to a file stdout.");
	fclose (stdout);