• print message to debug output window (VS)


    Some times we could want to print the debug messages to a window (console or windows) or a file, we debug our programms with these information. There's a better way to debug programm, print the message to output window if you use VS, and you can double click the message to locate the source codes. To achive this, you only need to:

    1. sprintf the message to format as: __FILE__(__LINE__):message string

    2. Invoke OutputDebugString() to print the message to ouput window.

    Note: for c++, OutputDebugString() is for printing message into Output window; for dotnet, Debug.WriteLine() is for the same purpose.

    else, you should want to print some messages to output window when compiling, yes you only need to:

    1. format the message string

    #define Stringize( L ) #L
    #define MakeString( M, L ) M(L)
    #define $Line MakeString(Stringize, __LINE__)
    #define Reminder(_s_) __FILE__"("$Line"):"_s_

    2. output

    #pragma message(Reminder("aabbccddeeff"))


    转自:http://blog.csdn.net/sunningPig

  • 相关阅读:
    p2394 精度题
    线性筛素数
    poj3468 线段树的懒惰标记
    逆元
    2018 Multi-University Training Contest 2
    2018 Multi-University Training Contest 1
    判断素数遇到的问题
    Mergeable Stack(链表实现栈)
    组合数
    poj2594 机器人寻找宝藏(最小路径覆盖)
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/2023810.html
Copyright © 2020-2023  润新知