1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <iostream>
10 
11 // wistream wcin;
12 
13 // UNSUPPORTED: no-wide-characters
14 // REQUIRES: target={{.+}}-windows-{{.+}}
15 
16 // FILE_DEPENDENCIES: test.dat
17 // RUN: %{build}
18 // RUN: cat test.dat | %{exec} %t.exe
19 
20 // Check that wcin works, preserving the unicode characters, after switching
21 // stdin to wide mode.
22 
23 #include <iostream>
24 #include <cassert>
25 #include <io.h>
26 #include <fcntl.h>
27 
main(int,char **)28 int main(int, char**) {
29     _setmode(_fileno(stdin), _O_WTEXT);
30     std::wstring str;
31     std::wcin >> str;
32     assert(str == L"1234\u20ac\u00e5\u00e4\u00f6");
33     return 0;
34 }
35