#include <xtd/io/file>
#include <xtd/io/file_info>
#include <xtd/io/path>
#include <xtd/console>
auto main() -> int {
auto test_file = path::combine(path::get_temp_path(), "test_file.txt");
file::write_all_text(test_file, "Hello, World!");
console::write_line(
"full_name = {}", fi.
full_name());
console::write_line(
" attributes = {}", fi.
attributes());
console::write_line(
" exists = {}", fi.
exists());
console::write_line(
" extension = {}", fi.
extension());
console::write_line(
" length = {}", fi.
length());
console::write_line(
" name = {}", fi.
name());
console::write_line(
" to_string = {}", fi.
to_string());
file::remove(test_file);
}
Provides static methods for the creation, copying, deletion, moving, and opening of files,...
Definition file_info.h:41
bool exists() const override
Gets a value indicating whether a file exists.
size_t length() const
Gets the size, in bytes, of the current file.
xtd::string name() const override
Gets the name of the file.
const xtd::date_time & last_access_time() const
Gets the time the current file or directory was last accessed.
const xtd::date_time & creation_time() const
Gets the creation time of the current file or directory.
xtd::io::file_attributes attributes() const
Gets the attributes for the current file or directory.
xtd::string full_name() const
Gets the full path of the directory or file.
const xtd::date_time & last_write_time() const
Gets the time when the current file or directory was last written to.
xtd::string to_string() const noexcept override
Returns the original path. Use the xtd::io::file_system_info::full_name or xtd::io::file_system_info:...
virtual xtd::string extension() const
Gets the extension part of the file name, including the leading dot . even if it is the entire file n...
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.h:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10