KFR

Binary IO functions

fopen_portable

inline FILE *fopen_portable(const filepath_char *path, const filepath_char *mode)

Opens file using portable path (char* on posix, wchar_t* on windows)

Source:

inline FILE* fopen_portable(const filepath_char* path, const filepath_char* mode)
{
#ifdef CMT_OS_WIN
    FILE* f   = nullptr;
    errno_t e = _wfopen_s(&f, path, mode);
    return f;
#else
    return fopen(path, mode);
#endif
}

seek_origin

enum seek_origin

Seek origin

enumerator current = SEEK_CUR

From the current position

enumerator begin = SEEK_SET

From the beginning

enumerator end = SEEK_END

From the end

abstract_stream

template<typename T = void>
class abstract_stream

Base class for all typed readers and writer

abstract_reader

template<typename T = void>
class abstract_reader

Base class for all typed readers

abstract_writer

template<typename T = void>
class abstract_writer

Base class for all typed writers

binary_reader

using binary_reader = abstract_reader<>

Binary reader

Source:

using binary_reader = abstract_reader<>

binary_writer

using binary_writer = abstract_writer<>

Binary writer

Source:

using binary_writer = abstract_writer<>

byte_reader

using byte_reader = abstract_reader<u8>

Byte reader

Source:

using byte_reader   = abstract_reader<u8>

byte_writer

using byte_writer = abstract_writer<u8>

Byte writer

Source:

using byte_writer   = abstract_writer<u8>

f32_reader

using f32_reader = abstract_reader<f32>

float reader

Source:

using f32_reader    = abstract_reader<f32>

f32_writer

using f32_writer = abstract_writer<f32>

float writer

Source:

using f32_writer    = abstract_writer<f32>

file_reader

template<typename T = void>
class file_reader

Typed file reader

file_writer

template<typename T = void>
class file_writer

Typed file writer

open_file_for_reading

template<typename T = void>
inline std::shared_ptr<file_reader<T>> open_file_for_reading(const filepath &path)

Opens typed file for reading

Source:

template <typename T = void>
inline std::shared_ptr<file_reader<T>> open_file_for_reading(const filepath& path)

open_file_for_writing

template<typename T = void>
inline std::shared_ptr<file_writer<T>> open_file_for_writing(const filepath &path)

Opens typed file for writing

Source:

template <typename T = void>
inline std::shared_ptr<file_writer<T>> open_file_for_writing(const filepath& path)

open_file_for_appending

template<typename T = void>
inline std::shared_ptr<file_writer<T>> open_file_for_appending(const filepath &path)

Opens typed file for appending

Source:

template <typename T = void>
inline std::shared_ptr<file_writer<T>> open_file_for_appending(const filepath& path)

open_file_for_reading

template<typename T = void>
inline std::shared_ptr<file_reader<T>> open_file_for_reading(const std::string &path)

Opens typed file for reading

Source:

template <typename T = void>
inline std::shared_ptr<file_reader<T>> open_file_for_reading(const std::string& path)

open_file_for_writing

template<typename T = void>
inline std::shared_ptr<file_writer<T>> open_file_for_writing(const std::string &path)

Opens typed file for writing

Source:

template <typename T = void>
inline std::shared_ptr<file_writer<T>> open_file_for_writing(const std::string& path)

open_file_for_appending

template<typename T = void>
inline std::shared_ptr<file_writer<T>> open_file_for_appending(const std::string &path)

Opens typed file for appending

Source:

template <typename T = void>
inline std::shared_ptr<file_writer<T>> open_file_for_appending(const std::string& path)