INGOR
Public Member Functions | List of all members
ytStdioBuff Class Reference

Standard input buffer. More...

#include <ytStdioBuff.h>

Public Member Functions

int ytStdioBuff_read ()
 Reads multiple data from the standard input and buffers them. More...
 
FILE * ytStdioBuff_getRead (size_t index)
 Returns the file stream corresponding to the read data. More...
 
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. More...
 

Detailed Description

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.

Member Function Documentation

◆ ytStdioBuff_checkOutFile()

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.

Returns
Index of the standard output position if applicable. Otherwise, -1.

◆ ytStdioBuff_getRead()

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.

Parameters
indexindex of a data set to return (zero origin).
returnFILE pointer representing the buffer read from the standard input.

◆ ytStdioBuff_read()

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().


The documentation for this class was generated from the following file: