2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
// author: Max Kellermann <max.kellermann@gmail.com>
|
2014-07-30 19:10:28 +02:00
|
|
|
|
2018-07-19 14:02:37 +02:00
|
|
|
#ifndef STDIO_OUTPUT_STREAM_HXX
|
|
|
|
#define STDIO_OUTPUT_STREAM_HXX
|
2014-07-30 19:10:28 +02:00
|
|
|
|
|
|
|
#include "OutputStream.hxx"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
class StdioOutputStream final : public OutputStream {
|
|
|
|
FILE *const file;
|
|
|
|
|
|
|
|
public:
|
2019-01-22 09:03:35 +01:00
|
|
|
explicit StdioOutputStream(FILE *_file) noexcept:file(_file) {}
|
2014-07-30 19:10:28 +02:00
|
|
|
|
|
|
|
/* virtual methods from class OutputStream */
|
2015-12-16 10:24:43 +01:00
|
|
|
void Write(const void *data, size_t size) override {
|
2014-07-30 19:10:28 +02:00
|
|
|
fwrite(data, 1, size, file);
|
|
|
|
|
|
|
|
/* this class is debug-only and ignores errors */
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|