onunix 2024-04-28 10:34 采纳率: 77.8%
浏览 20

请问vs code的printf的结果怎么这么难看

使用visual studio Code 1.88.1编译了一个程序,

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "E:\\tt\\mingw-w64-gcc-13.2-stable-r40\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

在右下角Terminal窗口:看到如下结果:
& 'c:\Users\test.vscode\extensions\ms-vscode.cpptools-1.19.9-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-xp04b1jd.o3a' '--stdout=Microsoft-MIEngine-Out-4vfi4ctl.2if' '--stderr=Microsoft-MIEngine-Error-2j4do4xh.xhp' '--pid=Microsoft-MIEngine-Pid-ox03rpxb.cfl' '--dbgExe=E:\tt\mingw-w64-gcc-13.2-stable-r40\bin\gdb.exe' '--interpreter=mi'
sizeof(Test) = 94do4xh.xhp' '--pid=Microsoft-MIEngine-Pid-ox03rpxb.cfl' '--dbgExe=E:\x5cyu\x5cmingw-w64-gcc-13.2-stable-r40\x5cbin\x5cgdb.exe' '--interpreter=mi' ;646ee963-3580-4e96-85d3-df1b40eed4d5oft-MIEng1 2 3 5 6 4j4do4xh.xhp' '--pid=Microsoft-MIEngine-Pid-ox03rpxb.cfl' '--dbgExe=E:\x5cyu\x5cmingw-w64-gcc-13.2-stable-r40\x5cbin\x5cgdb.exe' '--interpreter=mi' ;646ee963-3580-4e96-85d3-df1b40eed4d5

其中 sizeof(Test) = 9 1 2 3 5 6 4 是程序的printf的结果,这样混在执行命令中,根本没法看,请问需要如何处理呢?

  • 写回答

6条回答 默认 最新

  • 关注

    在launch.json中将console设置是否为"console": "externalTerminal",这样你的程序将在外部终端中运行,输出会更加清晰且不会与调试信息混杂。

    评论

报告相同问题?

问题事件

  • 创建了问题 4月28日