File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ // ===-- Internal implementation header of scanf -----------------*- C++ -*-===//
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+ #include " src/__support/OSUtil/io.h"
10+ #include " src/__support/macros/config.h"
11+ #include " src/stdio/scanf_core/reader.h"
12+
13+ namespace LIBC_NAMESPACE_DECL {
14+
15+ namespace scanf_core {
16+
17+ struct StdinReader : public Reader <StdinReader> {
18+ LIBC_INLINE char getc () {
19+ char buf[1 ];
20+ auto result = read_from_stdin (buf, sizeof (buf));
21+ if (result <= 0 )
22+ return EOF;
23+ return buf[0 ];
24+ }
25+ LIBC_INLINE void ungetc (int ) {}
26+ };
27+
28+ } // namespace scanf_core
29+
30+ } // namespace LIBC_NAMESPACE_DECL
You can’t perform that action at this time.
0 commit comments