Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
C输出调试信息到VS的“输出窗口” - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


https://blog.csdn.net/weixin_34054866/article/details/92711938


方法1

直接使用VS的函数OutputDebugString

char chInput[512];  
sprintf(chInput, "int:%d\n", 500);  
OutputDebugString(chInput);



方法2

使用上文博主封装的函数

void OutputDebugPrintf(const char *strOutputString, ...)
{
    char strBuffer[4096] = {0};
    va_list vlArgs;
    va_start(vlArgs, strOutputString);
    _vsnprintf_s(strBuffer, sizeof(strBuffer) - 1, strOutputString, vlArgs);
    va_end(vlArgs);
    OutputDebugString(CA2W(strBuffer));
}

int main()
{
    int i = 10;
    OutputDebugPrintf("I'm %d years old.\n", i);
    while(1){}
    return 0;
}




返回首页


Copyright (C) 2018-2024 huidong