]>
Commit | Line | Data |
---|---|---|
09625c16 PC |
1 | // 2004-01-11 Petur Runolfsson <peturr02@ru.is> |
2 | ||
aa118a03 | 3 | // Copyright (C) 2004-2014 Free Software Foundation, Inc. |
09625c16 PC |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
748086b7 | 8 | // Free Software Foundation; either version 3, or (at your option) |
09625c16 PC |
9 | // any later version. |
10 | ||
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | ||
16 | // You should have received a copy of the GNU General Public License along | |
748086b7 JJ |
17 | // with this library; see the file COPYING3. If not see |
18 | // <http://www.gnu.org/licenses/>. | |
09625c16 PC |
19 | |
20 | #include <iostream> | |
21 | #include <string> | |
22 | #include <locale> | |
23 | ||
24 | // libstdc++/13582 | |
25 | void test01() | |
26 | { | |
27 | bool test __attribute__((unused)) = true; | |
28 | using namespace std; | |
29 | ||
30 | ios_base::sync_with_stdio(false); | |
31 | wcout << "Type in 12345\n"; | |
32 | ||
33 | wstring str; | |
34 | wchar_t c; | |
35 | ||
36 | if (wcin.get(c) && !isspace(c, wcin.getloc())) | |
37 | { | |
38 | str.push_back(c); | |
39 | wcin.imbue(locale("en_US")); | |
40 | } | |
41 | ||
42 | if (wcin.get(c) && !isspace(c, wcin.getloc())) | |
43 | { | |
44 | str.push_back(c); | |
45 | wcin.imbue(locale("fr_FR")); | |
46 | } | |
47 | ||
48 | while (wcin.get(c) && !isspace(c, wcin.getloc())) | |
49 | { | |
50 | str.push_back(c); | |
51 | } | |
52 | ||
53 | wcout << str << endl; | |
54 | } | |
55 | ||
56 | int main() | |
57 | { | |
58 | test01(); | |
59 | return 0; | |
60 | } |