|
reldb 0.1.0
Recreational SQLite
|
Defines the InputBuffer structure and related I/O functions. More...
#include <stddef.h>#include <stdio.h>#include <stdlib.h>

Go to the source code of this file.
Classes | |
| struct | InputBuffer |
| A structure to hold dynamically allocated string input data. More... | |
Typedefs | |
| typedef ptrdiff_t | ssize_t |
| Signed size type, typically used to represent lengths or -1 for errors. | |
Functions | |
| InputBuffer * | new_input_buffer (void) |
| Allocates and initializes a new InputBuffer. | |
| ssize_t | getline (char **lineptr, size_t *n, FILE *stream) |
| Reads an entire line from a stream into a dynamically resizing buffer. | |
| void | read_input (InputBuffer *input_buffer) |
| Reads a line of input from standard input into the buffer. | |
| void | close_input_buffer (InputBuffer *input_buffer) |
| Frees the memory associated with an InputBuffer. | |
Defines the InputBuffer structure and related I/O functions.
Provides a dynamic buffer structure and helper functions to safely read arbitrary-length input from a file stream or standard input.
Definition in file inputbuffer.h.
| typedef ptrdiff_t ssize_t |
Signed size type, typically used to represent lengths or -1 for errors.
Definition at line 18 of file inputbuffer.h.
| void close_input_buffer | ( | InputBuffer * | input_buffer | ) |
Frees the memory associated with an InputBuffer.
| [in] | input_buffer | The buffer to free. Must not be NULL. |
Definition at line 72 of file inputbuffer.c.

| ssize_t getline | ( | char ** | lineptr, |
| size_t * | n, | ||
| FILE * | stream ) |
Reads an entire line from a stream into a dynamically resizing buffer.
| [in,out] | lineptr | Pointer to the character buffer pointer. |
| [in,out] | n | Pointer to the size of the allocated buffer. |
| [in] | stream | The file stream to read from (e.g., stdin). |
Definition at line 24 of file inputbuffer.c.

| InputBuffer * new_input_buffer | ( | void | ) |
Allocates and initializes a new InputBuffer.
Creates a fresh InputBuffer struct on the heap, setting its pointers to NULL and lengths to 0.
Definition at line 9 of file inputbuffer.c.
| void read_input | ( | InputBuffer * | input_buffer | ) |
Reads a line of input from standard input into the buffer.
Wraps getline to safely read from stdin. It also strips the trailing newline character and updates the input_length property. Exits the program automatically if reading fails.
| [in,out] | input_buffer | The buffer to read data into. |
Definition at line 56 of file inputbuffer.c.
