INGOR
|
Standard input buffer. More...
#include <ytStdioBuff.h>
Public Member Functions | |
int | ytStdioBuff_read () |
Reads multiple data from the standard input and buffers them. | |
FILE * | ytStdioBuff_getRead (size_t index) |
Returns the file stream corresponding to the read data. | |
void | ytStdioBuff_prepare () |
Prepares the buffer to write. | |
int | ytStdioBuff_ready () |
Returns non-zero if the buffer is ready to write. | |
FILE * | ytStdioBuff_getWrite (size_t index) |
Returns the file stream corresponding to the indexed buffer to write. | |
void | ytStdioBuff_flush () |
Flushes the writing buffer to the standard output. | |
int | ytStdioBuff_checkOutFile (const char *filename) |
Return the standard output index if the file name has the form and the standard output buffer is enabled. | |
Standard input buffer.
This enables to read multiple input data sets from the standard input. Such different data sets are generally provided as separated files. Instead, by giving data to the standard input by separating each data set with the "file seperator" control character, you can give multiple input data sets at once via the standard input.
After calling ytStdioBuff_read(), the file name of "STDIN_
n", where n represents the index of the input data sets, is recongnized as the n-th data set read from the standard input if you use ytFile_ropen() to get the file stream pointer.
int ytStdioBuff_checkOutFile | ( | const char * | filename | ) |
Return the standard output index if the file name has the form and the standard output buffer is enabled.
FILE * ytStdioBuff_getRead | ( | size_t | index | ) |
Returns the file stream corresponding to the read data.
Call ytStdioBuff_read() before calling this.
If the index exceeds the number of data sets read from the standard input, it stops as an error.
index | index of a data set to return (zero origin). |
return | FILE pointer representing the buffer read from the standard input. |
int ytStdioBuff_read | ( | ) |
Reads multiple data from the standard input and buffers them.
This reads data from the standard input and buffers them in memory.
Each unit of data needs to be separated by the File Separator (FS) control character (28 in decimal or 0x1c in hex).
The pointer to the file stream of the multiple data can be obtained by ytStdioBuff_get().