ATC :: Since February 2001

Subscribe to ATC Send e-mail to Rob

I work at Pelco. The opinions expressed here are my own, and neither Pelco nor any other party necessarily agrees with them.

View Rob Fahrni's profile on LinkedIn

Google
Web rob.crabapples.net



Krusty will code C++ for food.

Need a Snow Day?


RSS
Harry Potter Automatic News Aggregator
Green Hosting! This site is hosted by Dreamhost.

Wednesday, April 16, 2008

Visual Studio Debugging Tip - [8:10 AM]

Sara Ford: "if you double-click on any error or warning in the output window, you will jump directly to that location in the file (or the closest equivalent)" - Good tip. If you're interested in taking advantage of this sort of functionality in your own code, it's very easy.

Please note, the code below is very simplified, and for demonstration purposes only. You'd want to wrap this is a way that makes sense for your application. ATL and MFC provide this sort of stuff, but you can roll your own.

char buffer[MAX_PATH];
// Yes, I know this is an unsafe CRT call. :-)
sprintf(buffer, "%s(%d): Debug Message\n", __FILE__, __LINE__);
OutputDebugString(buffer);
So what does that do? It will dump something similar the following to the Output window...

c:\yoursource\yourfile.cpp(99): Debug Message

Now if you follow Sara's tip it will jump you right to the code that dumped out the message.

Labels: , ,


Click here for a permalink to this entry. comment