xtd_io was merged into xtd.
xtd.io is a modern c++17 library, that allow reading and writing to files and data streams, and that provide basic file and directory support, for Windows, macOS, Linux, iOS and android.
- File : Provides methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of std::basic_fstream objects.
- Path : Performs operations on std::basic_string instances that contain file or directory path information. These operations are performed in a cross-platform manner. For more information see xtd.io website (or markdown documentations) and Reference Guide.
The classic first application 'Hello World'.
src/tunit_hello_world.cpp:
#include <xtd/xtd.io>
#include <iostream>
#include <string>
using namespace std;
using namespace xtd::io;
// The main entry point for the application.
int main(int argc, char* argv[]) {
string file_name = path::combine(path::get_temp_path(), "file.txt");
file::write_all_text(file_name, "Hello, World!");
cout << file::read_all_text(file_name) << endl;
file::remove(file_name);
}
CMakeLists.txt:
cmake_minimum_required(VERSION 3.3)
project(io_hello_world)
find_package(xtd.io REQUIRED)
add_executable(${PROJECT_NAME} src/io_hello_world.cpp)
target_link_libraries(${PROJECT_NAME} xtd.io)
Output:
Hello, World!
For more examples see examples
Before running examples you must download and install tunit. To download and install it read downloads file.
© 2019 Gammasoft.