Skip to content

Commit 062804f

Browse files
committed
Include scanf_internal.h
1 parent 3cffce6 commit 062804f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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

0 commit comments

Comments
 (0)