Class SBIFileReader#
SBIFileReader is a utility class to read files.
#include <SBIFileReader.hpp>
Public Static Functions#
| Type | Name |
|---|---|
| void | getFileLines (const std::string & fileName, std::vector< std::string > & fileLineVector) Reads a file and splits its contents into lines. |
| char * | loadFileAsCharArray (const std::string & fileName) Loads an entire file into a dynamically allocated null‑terminated character array. |
Public Static Functions Documentation#
function getFileLines#
Reads a file and splits its contents into lines.
static void SBIFileReader::getFileLines (
const std::string & fileName,
std::vector< std::string > & fileLineVector
)
This function opens the specified file, reads its contents in binary mode, and separates the content into individual lines. It handles different line‑ending conventions (LF, CRLF, CR) and stores each line in the provided vector.
Parameters:
fileNameThe path to the file to be read.fileLineVectorThe vector that will receive the lines from the file.
function loadFileAsCharArray#
Loads an entire file into a dynamically allocated null‑terminated character array.
This function opens the specified file, reads its entire contents, and returns a pointer to a newly allocated character array containing the file data followed by a null terminator. The caller is responsible for freeing the returned memory.
Parameters:
fileNameThe path to the file to be loaded.
Returns:
A pointer to a null‑terminated character array containing the file contents, or nullptr if the file could not be opened or memory allocation failed.