|
CX Framework
Cross-platform C utility framework
|
Functions | |
| bool | conWrite (ConStream *con, const void *buf, size_t sz) |
| bool | conPuts (ConStream *con, strref s) |
| bool | conPutsz (ConStream *con, const char *sz) |
| bool | conPutc (ConStream *con, int32 codepoint) |
| bool | conNL (ConStream *con) |
| bool | conFlush (ConStream *con) |
| bool | _conFmt (ConStream *con, strref fmt, int n, stvar *args) |
| bool _conFmt | ( | ConStream * | con, |
| strref | fmt, | ||
| int | n, | ||
| stvar * | args | ||
| ) |
bool conFmt(ConStream *con, strref fmt, ...);
Formats arguments with cx's type-safe formatter (see Formatting) and writes the result, exactly as if by strFormat() into a temporary string followed by conPuts().
| con | Destination stream |
| fmt | Format string |
Example:
| bool conFlush | ( | ConStream * | con | ) |
Forces any output buffered by this module to reach the underlying stream immediately.
| con | Stream to flush |
| bool conNL | ( | ConStream * | con | ) |
Writes a platform-appropriate newline ("\n" on unix/wasm, "\r\n" on Windows) and flushes if the stream is line-buffered. A conCreateMem() stream always gets a bare "\n" on every platform, since it exists to give tests byte-identical output.
| con | Destination stream |
| bool conPutc | ( | ConStream * | con, |
| int32 | codepoint | ||
| ) |
Writes a single Unicode code point, UTF-8 encoded. An invalid code point is replaced with U+FFFD.
| con | Destination stream |
| codepoint | Unicode code point to write |
| bool conPuts | ( | ConStream * | con, |
| strref | s | ||
| ) |
Writes a cx string to a stream. Rope-shaped strings are walked chunk by chunk with no flattening allocation.
| con | Destination stream |
| s | String to write (NULL or empty writes nothing and returns true) |
| bool conPutsz | ( | ConStream * | con, |
| const char * | sz | ||
| ) |
Writes a NUL-terminated C string to a stream.
| con | Destination stream |
| sz | String to write (NULL or empty writes nothing and returns true) |
| bool conWrite | ( | ConStream * | con, |
| const void * | buf, | ||
| size_t | sz | ||
| ) |
Writes raw bytes to a stream exactly as given – no encoding, no line-ending translation, no buffering policy beyond the stream's own.
| con | Destination stream |
| buf | Bytes to write |
| sz | Number of bytes |