mpd/src/io/StdioOutputStream.hxx

23 lines
510 B
C++
Raw Normal View History

// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
2024-02-26 13:01:12 +01:00
#pragma once
#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 */
}
};