Jump to content
  • Advertisement
Sign in to follow this  
smilleme

Get line number in MSVS 2003

This topic is 4733 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there! I have a little question. Is possible to get the line, where was thrown the exception and return the number of this line in exception? thx for help

Share this post


Link to post
Share on other sites
Advertisement
This information is available through the C preprocessor if you are using C++, by using the __LINE__ macro (which is an integer equal to the line it is on). Pass this information to the exception constructor to propagate it.

If you run the program with an attached debugger, the program will stop once an unhandled exception is thrown and show you where it was thrown from. This works in both C++ and C#.

Share this post


Link to post
Share on other sites
Additionally, the __FILE__ macro gives you the filename of the source file the aforementioned line is in.

Illco

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!