-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnicodeAnsi.cpp
61 lines (47 loc) · 1.64 KB
/
UnicodeAnsi.cpp
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* \file UnicodeAnsi.cpp
* \brief
*/
#include <StdStream/StdStream.h>
#include <StdTest/StdTest.h>
#include <Stl.h>
//--------------------------------------------------------------------------------------------------
int main(int, char **) {
// ANSI
{
std::string buff_A = "SomeText";
std::cout << "sizeof_A: " << sizeof("SomeText") << std::endl;
std::cout << "size_A: " << buff_A.size() << std::endl << std::endl;
}
// Unicode
{
std::wstring buff_W = L"SomeText";
std::cout << "sizeof_W: " << sizeof(L"SomeText") << std::endl;
std::cout << "size_W: " << buff_W.size() << std::endl << std::endl;
}
{
std::wstring str = L"Some string!!!";
/// ::send(0, reinterpret_cast<char const*>(str.data()), str.size() * sizeof(std::wstring::value_type), 0);
}
std::cout << std::endl << std::endl;
std::cout << "sizeof_CHAR: " << sizeof("SomeText") << std::endl;
std::cout << "sizeof_WCHAR: " << sizeof(L"SomeText") << std::endl;
std::cout << "sizeof_std::string: " << sizeof(std::string::value_type) << std::endl;
std::cout << "sizeof_std::wstring: " << sizeof(std::wstring::value_type) << std::endl;
std::cout << "sizeof_char: " << sizeof(char) << std::endl;
std::cout << "sizeof_wchar_t: " << sizeof(wchar_t) << std::endl;
return EXIT_SUCCESS;
}
//---------------------------------------------------------------------------
#if OUTPUT
sizeof_A: 9
size_A: 8
sizeof_W: 36
size_W: 8
sizeof_CHAR: 9
sizeof_WCHAR: 36
sizeof_std::string: 1
sizeof_std::wstring: 4
sizeof_char: 1
sizeof_wchar_t: 4
#endif