[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/string/wide/wmemcmp [Back]  [Original]

std::wmemcmp cppreference.com
cppreference.com

std::wmemcmp

cppreference.com
<tbody> </tbody>
int wmemcmp( const wchar_t* lhs, const wchar_t* rhs, std::size_t count );

count , lhs rhs. .

, .

count , .

lhs, rhs
count

, lhs rhs: lhs rhs .

0, count lhs rhs .

, lhs , rhs: rhs lhs .

wchar_t, : , .

#include <clocale>
#include <cwchar>
#include <iostream>
#include <locale>
#include <string>

void demo(const wchar_t* lhs, const wchar_t* rhs, std::size_t sz)
{
    std::wcout << std::wstring(lhs, sz);
    int rc = std::wmemcmp(lhs, rhs, sz);
    if (rc == 0)
        std::wcout << L"  ";
    else if (rc < 0)
        std::wcout << L"  ";
    else if (rc > 0)
        std::wcout << L"   ";
    std::wcout << std::wstring(rhs, sz) << L"   \n";
}

int main()
{
    std::setlocale(LC_ALL, "en_US.utf8");
    std::wcout.imbue(std::locale("en_US.utf8"));

    wchar_t a1[] = {L'',L'',L''};
    constexpr std::size_t sz = sizeof a1 / sizeof *a1;
    wchar_t a2[sz] = {L'',L'',L''};

    demo(a1, a2, sz);
    demo(a2, a1, sz);
    demo(a1, a1, sz);
}

:

     
      
     


() []

() []

() []
C wmemcmp

Web Proxy Viewer  |  New URL  |  Original Page