1. 풀이


c++에서 rest api 응답으로 wstring을 반환하기에 이를 활용하기 위한 연습


 2. 소스코드


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
int main() {
    std::string abc = "hello world!";
    std::wstring a;
    //string to wstring
    a.assign(abc.begin(), abc.end());
 
    for (int i = 0; i < a.size(); i++) {
        std::wcout << a[i];
    }
    std::wcout << std::endl;
    a += L" bye bye";
    //wstring to string
    abc.assign(a.begin(), a.end());
    for (int i = 0; i < abc.size(); i++) {
        std::wcout << abc[i];
    }
    std::wcout << std::endl;
}
cs


 3. 참고


질문이나 지적 있으시면 댓글로 남겨주세요~

도움 되셨으면 하트 꾹!


+ Recent posts