わびさびサンプルソース

WindowsやHTML5などのプログラムのサンプルコードやフリーソフトを提供します。

wcsicmpでワーニングC4996が出ない代替関数

wcsicmpを使うとwarning C4996が出る事があります。これを回避する関数は_wcsicmpとなります。

wcsicmpでワーニングC4996が出ない代替関数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <tchar.h>
#include <string>
#include <iostream>
#include <fstream>
#include <windows.h>
 
 
 
int _tmain
(
      int argc
    , _TCHAR* argv[]
)
{
    // 標準出力へユニコードを出力する
    setlocale( LC_ALL, "Japanese" );
 
    // wcsicmpの代替関数
    if ( 0 == _wcsicmp( L"test", L"test" ) ) {
        std::wcout << L"warning C4996は出ません!!" << std::endl;
    }
 
    // 正常終了
    return( 0 );
}

実行結果

warning C4996は出ません!!






わびさびサンプルソース

WindowsやHTML5などのプログラムのサンプルコードやフリーソフトを提供します。