Reputation: 11
TRACE("This is a TRACE statement\n");
OutputDebugString("dd");
for(int x=0; x<pDoc->r_length; x++)
{
TRACE("The value of x is %d\n", x);
for(int y=0; y<pDoc->c_length; y++)
{
TRACE("x = %d and y = %d\n", x, y);
data=pDoc->m_OpenImg[x][y]+100;//circle image +100
//choose method for Saturation.
if(data>255)
{
pDoc->m_ResultImg[x][y]=255;//save the output value
}
else
{
pDoc->m_ResultImg[x][y]=data;//save the output value.
}
}
}
I'm studying MFC in this semester. I want to see debug output with TRACE. (I found TRACE in MSDN) This is part of my MFC code. I put TRACE into for loop. Other than the issue TRACE and OutputDebugString is not working correctly, the other part of the code works fine. I want to see debug output. Help me please.
Upvotes: 0
Views: 3307
Reputation: 308364
When you use TRACE
or OutputDebugString
, the output does not go to the normal command window. Instead it goes to a special debug output stream. If you run the program from within Visual Studio, you can see this stream in the Output pane. If you are running it independently (in a command window, or by double-clicking on the icon) you need a special utility that can monitor the stream. One such utility is DebugView.
Note that TRACE
only works in Debug builds, while OutputDebugString
works in any build type.
Upvotes: 1