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