ladivic
|
Provides utilities for file input/output operations in C++. More...
#include <fstream>
#include <string>
#include <stdexcept>
#include <sys/stat.h>
#include <ldvc_type.hpp>
Go to the source code of this file.
Functions | |
template<typename T > | |
void | ldvc_write_file (const string &filename, const T &data) |
Writes data to a file. | |
template<typename T > | |
T | ldvc_read_file (const string &filename) |
Reads data from a file. | |
bool | ldvc_file_exists (const string &folder_path) |
Checks if a file exists. | |
bool | ldvc_create_folder (const string &folder_path, u16 mode) |
Creates a folder with the specified permissions. | |
bool | ldvc_delete_file (string file_path) |
Deletes a file specified by its path. | |
bool | ldvc_delete_folder (string folder_path) |
Deletes a folder specified by its path. | |
Provides utilities for file input/output operations in C++.
This header file defines functions for performing file input/output operations in C++, including writing data to a file, reading data from a file, checking file existence, and creating folders.
Definition in file ldvc_io.hpp.
Creates a folder with the specified permissions.
This function creates a folder at the specified path with the given permissions.
folder_path | The path of the folder to create. |
mode | The permissions for the folder. |
Deletes a file specified by its path.
This function deletes the file located at the specified file path.
file_path | The path to the file to be deleted. |
Deletes a folder specified by its path.
This function deletes the folder located at the specified folder path.
folder_path | The path to the folder to be deleted. |
Checks if a file exists.
This function checks if a file exists at the specified path.
filename | The filename or path of the file to check. |
Reads data from a file.
This function reads data from a file with the given filename and returns it. It opens the file in binary mode for reading and reads the binary representation of the data from the file.
T | The type of data to be read from the file. |
filename | The filename of the file to read from. |
std::runtime_error | Thrown if the file cannot be opened for reading. |
Definition at line 91 of file ldvc_io.hpp.
Writes data to a file.
This function writes the specified data to a file with the given filename. It opens the file in binary mode for writing and writes the binary representation of the data to the file.
T | The type of data to be written to the file. |
filename | The filename of the file to write to. |
data | The data to be written to the file. |
std::runtime_error | Thrown if the file cannot be opened for writing. |
Definition at line 63 of file ldvc_io.hpp.