Provides access to information on a drive.
- Inheritance
- xtd::object → xtd::io::drive_info
- Header
#include <xtd/io/drive_info>
- Namespace
- xtd::io
- Library
- xtd.core
- Examples
- The following code example demonstrates the use of the xtd::io::drive_info class to display information about all of the drives on the current system.
#include <xtd/io/drive_info>
#include <xtd/console>
#include <xtd/startup>
using namespace std;
class program {
public:
static auto main() {
for (auto d : all_drives) {
if (
d.is_ready() ==
true) {
}
}
}
};
|
| object ()=default |
| Create a new instance of the ultimate base class object. More...
|
|
bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object. More...
|
|
virtual size_t | get_hash_code () const noexcept |
| Serves as a hash function for a particular type. More...
|
|
virtual type_object | get_type () const noexcept |
| Gets the type of the current instance. More...
|
|
template<typename object_t > |
std::unique_ptr< object_t > | memberwise_clone () const noexcept |
| Creates a shallow copy of the current object. More...
|
|
static bool | equals (const object &object_a, const object &object_b) noexcept |
| Determines whether the specified object instances are considered equal. More...
|
|
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
| Determines whether the specified object instances are the same instance. More...
|
|
◆ drive_info()
xtd::io::drive_info::drive_info |
( |
const xtd::ustring & |
drive_name | ) |
|
|
explicit |
Provides access to information on the specified drive.
- Parameters
-
drive_name | A valid drive path or drive letter. This can be either uppercase or lowercase, 'a' to 'z'. A null value is not valid. |
- Exceptions
-
◆ available_free_space()
size_t xtd::io::drive_info::available_free_space |
( |
| ) |
const |
Indicates the amount of available free space on a drive, in bytes.
- Returns
- The amount of free space available on the drive, in bytes.
- Exceptions
-
- Examples
- The following code example demonstrates the use of the xtd::io::drive_info class to display information about all of the drives on the current system.
#include <xtd/io/drive_info>
#include <xtd/console>
#include <xtd/startup>
using namespace std;
class program {
public:
static auto main() {
for (auto d : all_drives) {
if (
d.is_ready() ==
true) {
}
}
}
};
◆ drive_format()
Gets the name of the file system, such as NTFS or FAT32.
- Returns
- The name of the file system on the specified drive.
- Exceptions
-
- Examples
- The following code example demonstrates the use of the xtd::io::drive_info class to display information about all of the drives on the current system.
#include <xtd/io/drive_info>
#include <xtd/console>
#include <xtd/startup>
using namespace std;
class program {
public:
static auto main() {
for (auto d : all_drives) {
if (
d.is_ready() ==
true) {
}
}
}
};
◆ drive_type()
Gets the drive type, such as CD-ROM, removable, network, or fixed.
- Returns
- One of the enumeration values that specifies a drive type.
- Examples
- The following code example demonstrates the use of the xtd::io::drive_info class to display information about all of the drives on the current system.
#include <xtd/io/drive_info>
#include <xtd/console>
#include <xtd/startup>
using namespace std;
class program {
public:
static auto main() {
for (auto d : all_drives) {
if (
d.is_ready() ==
true) {
}
}
}
};
◆ get_drives()
Retrieves the drive names of all logical drives on a computer.
- Returns
- An array of type xtd::ioo::drive_info that represents the logical drives on a computer.
- Exceptions
-
- Examples
- The following code example demonstrates the use of the xtd::io::drive_info class to display information about all of the drives on the current system.
#include <xtd/io/drive_info>
#include <xtd/console>
#include <xtd/startup>
using namespace std;
class program {
public:
static auto main() {
for (auto d : all_drives) {
if (
d.is_ready() ==
true) {
}
}
}
};
◆ is_ready()
bool xtd::io::drive_info::is_ready |
( |
| ) |
const |
|
noexcept |
Gets a value that indicates whether a drive is ready.
- Returns
- true if the drive is ready; false if the drive is not ready.
- Examples
- The following code example demonstrates the use of the xtd::io::drive_info class to display information about all of the drives on the current system.
#include <xtd/io/drive_info>
#include <xtd/console>
#include <xtd/startup>
using namespace std;
class program {
public:
static auto main() {
for (auto d : all_drives) {
if (
d.is_ready() ==
true) {
}
}
}
};
◆ name()
Gets the name of a drive, such as C:.
- Returns
- The name of the drive.
- Examples
- The following code example demonstrates the use of the xtd::io::drive_info class to display information about all of the drives on the current system.
#include <xtd/io/drive_info>
#include <xtd/console>
#include <xtd/startup>
using namespace std;
class program {
public:
static auto main() {
for (auto d : all_drives) {
if (
d.is_ready() ==
true) {
}
}
}
};
◆ root_directory()
Gets the root directory of a drive.
- Returns
- An object that contains the root directory of the drive.
◆ to_string()
Returns a drive name as a string.
- Returns
- The name of the drive.
Reimplemented from xtd::object.
◆ total_free_space()
size_t xtd::io::drive_info::total_free_space |
( |
| ) |
const |
Gets the total amount of free space available on a drive, in bytes.
- Returns
- The total free space available on a drive, in bytes.
- Exceptions
-
- Examples
- The following code example demonstrates the use of the xtd::io::drive_info class to display information about all of the drives on the current system.
#include <xtd/io/drive_info>
#include <xtd/console>
#include <xtd/startup>
using namespace std;
class program {
public:
static auto main() {
for (auto d : all_drives) {
if (
d.is_ready() ==
true) {
}
}
}
};
◆ total_size()
size_t xtd::io::drive_info::total_size |
( |
| ) |
const |
Gets the total size of storage space on a drive, in bytes.
- Returns
- The total size of the drive, in bytes.
- Exceptions
-
- Examples
- The following code example demonstrates the use of the xtd::io::drive_info class to display information about all of the drives on the current system.
#include <xtd/io/drive_info>
#include <xtd/console>
#include <xtd/startup>
using namespace std;
class program {
public:
static auto main() {
for (auto d : all_drives) {
if (
d.is_ready() ==
true) {
}
}
}
};
◆ volume_label()
Gets the volume label of a drive.
- Returns
- The volume label.
- Exceptions
-
- Examples
- The following code example demonstrates the use of the xtd::io::drive_info class to display information about all of the drives on the current system.
#include <xtd/io/drive_info>
#include <xtd/console>
#include <xtd/startup>
using namespace std;
class program {
public:
static auto main() {
for (auto d : all_drives) {
if (
d.is_ready() ==
true) {
}
}
}
};
◆ empty
The documentation for this class was generated from the following file: