xtd 0.2.0
hello_world_io.cpp

The classic first application "Hello, World!" with xtd::io::file and xtd::io::path classes.

#include <xtd/xtd>
using namespace xtd;
using namespace xtd::io;
auto main(int argc, char* argv[]) -> int {
auto file_name = path::combine(path::get_temp_path(), "hello_world.txt");
file::write_all_text(file_name, "Hello, World!");
file::remove(file_name);
}
// This code produces the following output :
//
// Hello, World!
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static xtd::string read_all_text(const xtd::string &path)
Opens a text file, reads all text of the file, and then closes the file.
static void remove(const xtd::string &path)
Deletes the specified file.
static void write_all_text(const xtd::string &path, type_t text)
Writes text to a file, and then closes the file. If the specified file does not exist,...
Definition file.hpp:359
static xtd::string get_temp_path() noexcept
Returns the path of the current user's temporary folder.
static xtd::string combine(const xtd::string &path1, const xtd::string &path2)
Combines two path strings.
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.hpp:17
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8