• <legend id='cDk3W'><style id='cDk3W'><dir id='cDk3W'><q id='cDk3W'></q></dir></style></legend>

      <bdo id='cDk3W'></bdo><ul id='cDk3W'></ul>

    1. <small id='cDk3W'></small><noframes id='cDk3W'>

      <tfoot id='cDk3W'></tfoot>
        <i id='cDk3W'><tr id='cDk3W'><dt id='cDk3W'><q id='cDk3W'><span id='cDk3W'><b id='cDk3W'><form id='cDk3W'><ins id='cDk3W'></ins><ul id='cDk3W'></ul><sub id='cDk3W'></sub></form><legend id='cDk3W'></legend><bdo id='cDk3W'><pre id='cDk3W'><center id='cDk3W'></center></pre></bdo></b><th id='cDk3W'></th></span></q></dt></tr></i><div id='cDk3W'><tfoot id='cDk3W'></tfoot><dl id='cDk3W'><fieldset id='cDk3W'></fieldset></dl></div>
      1. 在 Visual Studio 2010 中将输出消息写入“输出窗口

        时间:2023-05-23

        • <legend id='5whoL'><style id='5whoL'><dir id='5whoL'><q id='5whoL'></q></dir></style></legend>
              <tbody id='5whoL'></tbody>

              <tfoot id='5whoL'></tfoot>

            1. <i id='5whoL'><tr id='5whoL'><dt id='5whoL'><q id='5whoL'><span id='5whoL'><b id='5whoL'><form id='5whoL'><ins id='5whoL'></ins><ul id='5whoL'></ul><sub id='5whoL'></sub></form><legend id='5whoL'></legend><bdo id='5whoL'><pre id='5whoL'><center id='5whoL'></center></pre></bdo></b><th id='5whoL'></th></span></q></dt></tr></i><div id='5whoL'><tfoot id='5whoL'></tfoot><dl id='5whoL'><fieldset id='5whoL'></fieldset></dl></div>
                <bdo id='5whoL'></bdo><ul id='5whoL'></ul>
                1. <small id='5whoL'></small><noframes id='5whoL'>

                  本文介绍了在 Visual Studio 2010 中将输出消息写入“输出窗口"的最简单方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我已经尝试过 OutputDebugString 函数,但大部分时间我都会遇到如下错误:

                  I've tried OutputDebugString function and most of the time I get error like :

                  错误 C2664:OutputDebugStringA":无法将参数 1 从int"转换为LPCSTR"

                  error C2664: 'OutputDebugStringA' : cannot convert parameter 1 from 'int' to 'LPCSTR'

                  示例

                  尝试 1:

                  //ERROR: sprintf is unsafe. Use sprintf_s instead
                  int x = 4;
                  char s[256];
                  sprintf(s, "There is %d numbers", x);
                  OutputDebugString((LPCWSTR)s);
                  

                  尝试 2:

                  //FAIL: outputs junk (sprintf_s doesn't understand unicode?)
                  int x = 4;
                  char s[256];
                  sprintf_s(s, "There is %d numbers", x);
                  OutputDebugString((LPCWSTR)s);
                  

                  尝试 3:

                  //ERROR: no instance of overloaded function "sprintf_s" matches the argument list
                  int x = 4;
                  TCHAR s[256];
                  sprintf_s(s, "There is %d numbers", x);
                  OutputDebugString((LPCWSTR)s);
                  

                  尝试 4:

                  //ERROR: no instance of overloaded function "sprintf_s" matches the argument list
                  int x = 4;
                  TCHAR s[256];
                  sprintf_s(s, L"There is %d numbers", x);
                  OutputDebugString((LPCWSTR)s);
                  

                  尝试 5:

                  //ERROR: no instance of overloaded function "swprintf" matches the argument list
                  int x = 4;
                  TCHAR s[256];
                  swprintf(s, "There is %d numbers", x);
                  OutputDebugString(s);
                  

                  尝试 6:

                  //ERROR: 'swprintf': function has been changed to confirm with the ISO C standard, adding an extra character count parameter
                  int x = 4;
                  TCHAR s[256];
                  swprintf(s, L"There is %d numbers", x);
                  OutputDebugString(s);
                  

                  推荐答案

                  它只接受字符串作为参数,不接受整数.尝试类似

                  It only accepts a string as a parameter, not an integer. Try something like

                  sprintf(msgbuf, "My variable is %d
                  ", integerVariable);
                  OutputDebugString(msgbuf);
                  

                  有关更多信息,请查看 http://www.unixwiz.net/techtips/outputdebugstring.html

                  For more info take a look at http://www.unixwiz.net/techtips/outputdebugstring.html

                  这篇关于在 Visual Studio 2010 中将输出消息写入“输出窗口"的最简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 Windows 中使用 C++ 的颜色控制台输出 下一篇:通过引用将参数传递给 std::async 失败

                  相关文章

                  最新文章

                2. <tfoot id='3HUtE'></tfoot>

                    <small id='3HUtE'></small><noframes id='3HUtE'>

                      <legend id='3HUtE'><style id='3HUtE'><dir id='3HUtE'><q id='3HUtE'></q></dir></style></legend>
                      <i id='3HUtE'><tr id='3HUtE'><dt id='3HUtE'><q id='3HUtE'><span id='3HUtE'><b id='3HUtE'><form id='3HUtE'><ins id='3HUtE'></ins><ul id='3HUtE'></ul><sub id='3HUtE'></sub></form><legend id='3HUtE'></legend><bdo id='3HUtE'><pre id='3HUtE'><center id='3HUtE'></center></pre></bdo></b><th id='3HUtE'></th></span></q></dt></tr></i><div id='3HUtE'><tfoot id='3HUtE'></tfoot><dl id='3HUtE'><fieldset id='3HUtE'></fieldset></dl></div>

                      • <bdo id='3HUtE'></bdo><ul id='3HUtE'></ul>