UNICODE, UTF-8, MBCS 변환
// 1. MBCS를 UNICODE로 변환
  CHAR* cStr = "테스트" ;
  WCHAR wStr[5000];
  ::ZeroMemory(wStr, sizeof(wStr)); 
  ::MultiByteToWideChar(CP_ACP, 0, cStr , strlen(cStr)+1, wStr, sizeof(wStr)/sizeof(wStr[0]));
  ::MessageBoxW(NULL, wStr, L"MBCS -> UNICODE", MB_OK);


// 2. UNICODE -> UTF-8로 변환
    char cStr[20000];
    WCHAR *wStr = L"테스트";
    ::ZeroMemory(cStr, sizeof(cStr)); 
    ::WideCharToMultiByte(CP_UTF8, 0, wStr, -1, cStr, sizeof(cStr), NULL, NULL);
    ::MessageBoxA(NULL, cStr, "UNICODE -> UTF-8", MB_OK);

// 3. UTF-8 -> UNICODE로 변환
    WCHAR wStr[20000];
    char* utf8str = "테스트";
    MultiByteToWideChar(CP_UTF8, 0, utf8str, strlen(utf8str)+1, wStr, sizeof(wStr)/sizeof(wStr[0]));
    ::MessageBoxW(NULL, widewStrchar, L"UTF8 -> UNICODE", MB_OK);

// 4. UNICODE -> MBCS로 변환
    WCHAR *wStr = L"테스트";
    char cStr[20000];
    ::ZeroMemory(cStr, sizeof(cStr)); 
    ::WideCharToMultiByte(CP_ACP, 0, wStr, -1, cStr, sizeof(cStr), NULL, NULL);
    ::MessageBoxA(NULL, cStr, "UNICODE -> MBCS", MB_OK); 
by iNiT | 2010/11/05 12:01 | Programing | 트랙백 | 덧글(0)
Dshow에서 Null Renderer는 함부로 쓰지 말자~
오늘 WMV에서 WAV 추출중 발견한 현상~

NULL Renderer를 먼저 삽입 후 Render File 하게 되면
WMV의 audio 부분에 Null Renderer가 붙는다.

그래서 다음에 오류가 생긴다.

해결 방법.

Video Renderer와 DirectSound 필터를 먼저 로딩 후

파일 Render 후

Video Renderer를 삭제한 후

나중에 Null 렌더러를 추가한다.

자세한 내용은 추후에.....
by iNiT | 2010/01/28 21:48 | 트랙백 | 덧글(0)
Thread 프로그래밍시 시스템 느려질 경우...
쓰레드 기반 프로그래밍중 디버깅 시 시스템이 현저하게 느려지는 경우가 있다.

Create된 Thread가 정상적으로 Terminate Thread 되지 않아 발생하는 현상이라고 한다.

아직 테스트하진 못했지만 여기에 메모해둔다.

cmd에서
    taskkill /F /IM CcmExec.exe

    taskkill /F /IM ctfmon.exe

위의 두 명령어를 실행하여 두개의 프로세스를 죽이면 정상적으로 속도가 돌아온다.

디버깅 시작시에 항상 저 명령어를 입력한 후에 시작하는 습관을 들이도록 해야겠다.
by iNiT | 2009/07/15 15:01 | Programing | 트랙백 | 덧글(0)
time 함수 _tcsftime(strftime)의 format 값

struct tm 구조체를 가지고 시간값을 출력하고자 할 경우
strftime 함수를 사용한다.
strftime 매개 변수로 format이 있다.

%a    :
Abbreviated weekday name
%A    : Full weekday name
%b    : Abbreviated month name
%B    : Full month name
%c    : Date and time representation appropriate for locale
%d    : 일. Day of month as decimal number (01 – 31)
%H    : 시(24시기준). Hour in 24-hour format (00 – 23)
%I    : 시(12시기준). Hour in 12-hour format (01 – 12)
%j    : Day of year as decimal number (001 – 366)
%m    : 월. Month as decimal number (01 – 12)
%M    : 분. Minute as decimal number (00 – 59)
%p    : AM, PM 확인. Current locale’s A.M./P.M. indicator for 12-hour clock
%S    : 초. Second as decimal number (00 – 59)
%U    : Week of year as decimal number, with Sunday as first day of week (00 – 53)
%w    : Weekday as decimal number (0 – 6; Sunday is 0)
%W    : Week of year as decimal number, with Monday as first day of week (00 – 53)
%x    : Date representation for current locale
%X    : Time representation for current locale
%y    : 년도(2자리). Year without century, as decimal number (00 – 99)
%Y    : 년도(4자리). Year with century, as decimal number
%z, %Z    : Time-zone name or abbreviation; no characters if time zone is unknown
%%    : Percent sign

by iNiT | 2009/07/09 16:56 | Programing | 트랙백 | 덧글(0)
컴파일러에 따른 소스 구분하기

프로그래밍을 할때 여러 컴파일러를 대상으로 개발해야하는 경우

컴파일러마다 추천 함수가 모두 틀리다

그래서 컴파일러 별로 소스코드를 별도로 작성해야 한다.

Visual C++ 컴파일러 버전 구분값은 "_MSC_VER"이다.

주요 VC++ 버전별 _MSC_VER 값
    Visual C++ 6        : 1200
    Visual C++ 2005    : 1400
    Visual C++ 2008    : 1500

사용방법 :
    #if  _MSC_VER == 1200    // VC++ 6.0
        ;    
    #else if _MSC_VER == 1400    // VC++ 2005
        ;    
    #else if _MSC_VER == 1500    // VC++ 2008
        ;
   #endif

(추후 리눅스관련도 업데이트하자!!!)

by iNiT | 2009/07/09 14:43 | Programing | 트랙백 | 덧글(0)


< 이전페이지 다음페이지 >