1 //===-- FILE Writer class for printf ----------------------------*- 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 #ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FILE_WRITER_H 10 #define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FILE_WRITER_H 11 12 #include "src/__support/File/file.h" 13 #include <stddef.h> 14 15 namespace __llvm_libc { 16 namespace printf_core { 17 18 // write_to_file treats raw_pointer as a File and calls its write 19 // function. 20 void write_to_file(void *raw_pointer, const char *__restrict to_write, 21 size_t len) { 22 __llvm_libc::File *file = reinterpret_cast<__llvm_libc::File *>(raw_pointer); 23 file->write(to_write, len); 24 } 25 26 } // namespace printf_core 27 } // namespace __llvm_libc 28 29 #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FILE_WRITER_H 30