mpd/src/io/StdioOutputStream.hxx

26 lines
569 B
C++
Raw Normal View History

// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef STDIO_OUTPUT_STREAM_HXX
#define STDIO_OUTPUT_STREAM_HXX
#include "OutputStream.hxx"
#include <stdio.h>
class StdioOutputStream final : public OutputStream {
FILE *const file;
public:
explicit StdioOutputStream(FILE *_file) noexcept:file(_file) {}
/* virtual methods from class OutputStream */
2023-05-15 11:00:21 +02:00
void Write(std::span<const std::byte> src) override {
fwrite(src.data(), 1, src.size(), file);
/* this class is debug-only and ignores errors */
}
};
#endif