#include <BufPrint.h>
#include <IoIntf.h>
#include <BaServerLib.h>
Go to the source code of this file.
◆ IoBufPrint
BufPrint adapter for a writable ResIntf.
Write through the embedded BufPrint and explicitly flush/check its return before destruction when output errors must be observed. Flush consumes its buffered bytes even when the resource write fails; no retry buffer remains.
◆ IoBufPrint_create()
Open a file for writing and allocate a buffered writer.
- Parameters
-
| alloc | Required allocator, retained by the caller for final release. |
| io | Required borrowed writable I/O, kept alive through destruction. |
| bufSize | Requested buffer bytes, positive and at most 65535; allocation size arithmetic must not overflow. Allocator-adjusted capacity must also fit U16. |
| name | Required NUL-terminated I/O path, used during this call. |
- Returns
- Allocated writer, or NULL for open/allocation failure. OpenRes_WRITE can create/truncate the target before a later allocation failure. On success the adapter closes the opened resource during destruction. After destruction, release the adapter with the same allocator; destruction does not free it.
◆ IoBufPrint_create2()
Allocate a writer for an already open resource.
- Parameters
-
| alloc | Required allocator; caller retains it for final release. |
| bufSize | Positive byte capacity, at most 65535, including any allocator size adjustment. sizeof(IoBufPrint)+bufSize must be representable. |
| out | Required borrowed writable resource with writeFp installed. |
- Returns
- Allocated writer or NULL on allocation failure. This variant never closes out; the caller closes it after flushing/destroying the adapter.
◆ IoBufPrint_destructor()
| BA_API void IoBufPrint_destructor |
( |
IoBufPrint * |
o | ) |
|
Flush and release an adapter's owned resource.
- Parameters
-
| o | Required live adapter, consumed for further writing. An adapter from create closes its resource; one from create2 leaves it open. Flush and close errors are discarded. Release o separately through its allocator. |