欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 純C++中怎么輸出調試信息 [打印本頁]

作者: bibi    時間: 2015-4-18 20:54
標題: 純C++中怎么輸出調試信息
在MFC程序中有TRACE等一系列的宏可以輸出調試信息, 但是其他的地方不能用了, 下面這個小程序測試了怎么輸出調試信息,

// Test_ErrorCode.cpp : 定義控制臺應用程序的入口點。
//

#include "stdafx.h"
#include <Windows.h>
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>

void __cdecl odprintf(const char* fmt, ...)
{
        char buf[4096], *p = buf;
        va_list args;

        va_start(args, fmt);
        p += vsnprintf_s(p, sizeof(buf), _TRUNCATE, fmt, args);
        va_end(args);

        while ( p > buf  &&  isspace(p[-1]) )
                *--p = '\0';
        *p++ = '\r';
        *p++ = '\n';
        *p   = '\0';

        OutputDebugStringA(buf);        //OutputDebugString
}


int _tmain(int argc, _TCHAR* argv[])
{
        odprintf("Testing...");
        HANDLE hFile = CreateFile(_T("c://a.txt"), 0, 0, NULL, OPEN_EXISTING,0,NULL);
        odprintf("Retrieve last error code = %ld", ::GetLastError());

        return 0;
}









歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1