Skip to content

Print to stream #127

@FSMaxB

Description

@FSMaxB

As suggested by @iMobs in #89.

It is not guaranteed, that cJSON will ever support streaming, but if it will, here's some ideas on how it could be done.

The print functions have been switched to only supporting buffered printing recently. Streaming could be done by allocating a buffer every time the ensure function is called and flushing that buffer to the stream on the next call (or when it exceeds a certain size).

An important thing to keep in mind: This buffer can not be allocated on the stack, because it needs to be able to take any length.

The streaming functions could be passed through with cJSON_Hooks or similar.

In that model, cJSON would also be the caller and the program that uses cJSON for streaming would be the callee.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions