xref: /netbsd-src/tests/lib/libstdc++/h_cin_nosync.cc (revision 2a7fd23976faca0646a0fbff495ccb736ef7ab5c)
1*2a7fd239Sriastradh /*	$NetBSD: h_cin_nosync.cc,v 1.1 2024/04/28 01:21:27 riastradh Exp $	*/
2*2a7fd239Sriastradh 
3*2a7fd239Sriastradh /*-
4*2a7fd239Sriastradh  * Copyright (c) 2024 The NetBSD Foundation, Inc.
5*2a7fd239Sriastradh  * All rights reserved.
6*2a7fd239Sriastradh  *
7*2a7fd239Sriastradh  * Redistribution and use in source and binary forms, with or without
8*2a7fd239Sriastradh  * modification, are permitted provided that the following conditions
9*2a7fd239Sriastradh  * are met:
10*2a7fd239Sriastradh  * 1. Redistributions of source code must retain the above copyright
11*2a7fd239Sriastradh  *    notice, this list of conditions and the following disclaimer.
12*2a7fd239Sriastradh  * 2. Redistributions in binary form must reproduce the above copyright
13*2a7fd239Sriastradh  *    notice, this list of conditions and the following disclaimer in the
14*2a7fd239Sriastradh  *    documentation and/or other materials provided with the distribution.
15*2a7fd239Sriastradh  *
16*2a7fd239Sriastradh  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17*2a7fd239Sriastradh  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18*2a7fd239Sriastradh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19*2a7fd239Sriastradh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20*2a7fd239Sriastradh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*2a7fd239Sriastradh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*2a7fd239Sriastradh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*2a7fd239Sriastradh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*2a7fd239Sriastradh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*2a7fd239Sriastradh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*2a7fd239Sriastradh  * POSSIBILITY OF SUCH DAMAGE.
27*2a7fd239Sriastradh  */
28*2a7fd239Sriastradh 
29*2a7fd239Sriastradh #include <iostream>
30*2a7fd239Sriastradh 
31*2a7fd239Sriastradh int
main(void)32*2a7fd239Sriastradh main(void)
33*2a7fd239Sriastradh {
34*2a7fd239Sriastradh 	char buf[128];
35*2a7fd239Sriastradh 
36*2a7fd239Sriastradh 	std::ios::sync_with_stdio(false);
37*2a7fd239Sriastradh 	std::cin.read(buf, sizeof(buf));
38*2a7fd239Sriastradh 	std::cout << std::cin.gcount() << std::endl;
39*2a7fd239Sriastradh 	return 0;
40*2a7fd239Sriastradh }
41