mpd/src/io/StdioOutputStream.hxx
2023-05-21 21:35:11 +02:00

26 lines
569 B
C++

// 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 */
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