gpt4 book ai didi

c - 如何在 Visual Studio 2010 的 Win32 应用程序中查看 printf 输出?

转载 作者:可可西里 更新时间:2023-11-01 12:17:54 25 4
gpt4 key购买 nike

如何在 Win32 中查看 printf 输出? Visual Studio 2010 中的应用程序(使用 WinMain 输入) ?

最佳答案

编辑 2021,Visual Studio 2019

要将调试消息写入输出窗口,请使用 OutputDebugStringA来自 debugapi.h(包括 windows.h)

测试.c

#include <windows.h>
#include <stdio.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdShow, int nCmdShow)
{
int number = 10;
char str[256];
sprintf_s(str, sizeof(str), "It works! - number: %d \n", number);

OutputDebugStringA(str);

return 0;
}

在 Visual Studio 2019 上测试,调试/x64。

或者使用我的插件 header文件。

关于c - 如何在 Visual Studio 2010 的 Win32 应用程序中查看 printf 输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3009042/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com