Provides access to information on a drive. 
Provides access to information on a drive.
Definition drive_info.hpp:33
 
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:42
 
#define core_export_
Define shared library export.
Definition core_export.hpp:13
 
  - 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>
 
 
class program {
public:
  static auto main() {
    auto all_drives = drive_info::get_drives();
    
    for (auto d : all_drives) {
      console::write_line(
"Drive {0}", 
d.name());
 
      console::write_line(
"  Drive type: {0}", 
d.drive_type());
 
      if (
d.is_ready() == 
true) {
 
        console::write_line(
"  Volume label: {0}", 
d.volume_label());
 
        console::write_line(
"  File system: {0}", 
d.drive_format());
 
        console::write_line(
"  Available space to current user:{0, 15} bytes", 
d.available_free_space());
 
        console::write_line(
"  Total available space:          {0, 15} bytes", 
d.total_free_space());
 
        console::write_line(
"  Total size of drive:            {0, 15} bytes", 
d.total_size());
 
      }
    }
  }
};
 
 
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:175
 
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.hpp:16
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
 
   
 | 
|   | object ()=default | 
|   | Create a new instance of the ultimate base class object.  
  | 
|   | 
| virtual bool  | equals (const object &obj) const noexcept | 
|   | Determines whether the specified object is equal to the current object.  
  | 
|   | 
| virtual size_t  | get_hash_code () const noexcept | 
|   | Serves as a hash function for a particular type.  
  | 
|   | 
| virtual type_object  | get_type () const noexcept | 
|   | Gets the type of the current instance.  
  | 
|   | 
| template<typename object_t >  | 
| xtd::uptr< object_t >  | memberwise_clone () const | 
|   | Creates a shallow copy of the current object.  
  | 
|   | 
| template<typename object_a_t , typename object_b_t >  | 
| static bool  | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept | 
|   | Determines whether the specified object instances are considered equal.  
  | 
|   | 
| template<typename object_a_t , typename object_b_t >  | 
| static bool  | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept | 
|   | Determines whether the specified object instances are the same instance.  
  | 
|   | 
◆ drive_info()
  
  
      
        
          | xtd::io::drive_info::drive_info  | 
          ( | 
          const xtd::string &  | 
          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>
 
 
class program {
public:
  static auto main() {
    auto all_drives = drive_info::get_drives();
    
    for (auto d : all_drives) {
      console::write_line(
"Drive {0}", 
d.name());
 
      console::write_line(
"  Drive type: {0}", 
d.drive_type());
 
      if (
d.is_ready() == 
true) {
 
        console::write_line(
"  Volume label: {0}", 
d.volume_label());
 
        console::write_line(
"  File system: {0}", 
d.drive_format());
 
        console::write_line(
"  Available space to current user:{0, 15} bytes", 
d.available_free_space());
 
        console::write_line(
"  Total available space:          {0, 15} bytes", 
d.total_free_space());
 
        console::write_line(
"  Total size of drive:            {0, 15} bytes", 
d.total_size());
 
      }
    }
  }
};
 
 
   
 
 
◆ drive_format()
      
        
          | xtd::string xtd::io::drive_info::drive_format  | 
          ( | 
           | ) | 
           const | 
        
      
 
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>
 
 
class program {
public:
  static auto main() {
    auto all_drives = drive_info::get_drives();
    
    for (auto d : all_drives) {
      console::write_line(
"Drive {0}", 
d.name());
 
      console::write_line(
"  Drive type: {0}", 
d.drive_type());
 
      if (
d.is_ready() == 
true) {
 
        console::write_line(
"  Volume label: {0}", 
d.volume_label());
 
        console::write_line(
"  File system: {0}", 
d.drive_format());
 
        console::write_line(
"  Available space to current user:{0, 15} bytes", 
d.available_free_space());
 
        console::write_line(
"  Total available space:          {0, 15} bytes", 
d.total_free_space());
 
        console::write_line(
"  Total size of drive:            {0, 15} bytes", 
d.total_size());
 
      }
    }
  }
};
 
 
   
 
 
◆ 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>
 
 
class program {
public:
  static auto main() {
    auto all_drives = drive_info::get_drives();
    
    for (auto d : all_drives) {
      console::write_line(
"Drive {0}", 
d.name());
 
      console::write_line(
"  Drive type: {0}", 
d.drive_type());
 
      if (
d.is_ready() == 
true) {
 
        console::write_line(
"  Volume label: {0}", 
d.volume_label());
 
        console::write_line(
"  File system: {0}", 
d.drive_format());
 
        console::write_line(
"  Available space to current user:{0, 15} bytes", 
d.available_free_space());
 
        console::write_line(
"  Total available space:          {0, 15} bytes", 
d.total_free_space());
 
        console::write_line(
"  Total size of drive:            {0, 15} bytes", 
d.total_size());
 
      }
    }
  }
};
 
 
   
 
 
◆ 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>
 
 
class program {
public:
  static auto main() {
    auto all_drives = drive_info::get_drives();
    
    for (auto d : all_drives) {
      console::write_line(
"Drive {0}", 
d.name());
 
      console::write_line(
"  Drive type: {0}", 
d.drive_type());
 
      if (
d.is_ready() == 
true) {
 
        console::write_line(
"  Volume label: {0}", 
d.volume_label());
 
        console::write_line(
"  File system: {0}", 
d.drive_format());
 
        console::write_line(
"  Available space to current user:{0, 15} bytes", 
d.available_free_space());
 
        console::write_line(
"  Total available space:          {0, 15} bytes", 
d.total_free_space());
 
        console::write_line(
"  Total size of drive:            {0, 15} bytes", 
d.total_size());
 
      }
    }
  }
};
 
 
   
 
 
◆ 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>
 
 
class program {
public:
  static auto main() {
    auto all_drives = drive_info::get_drives();
    
    for (auto d : all_drives) {
      console::write_line(
"Drive {0}", 
d.name());
 
      console::write_line(
"  Drive type: {0}", 
d.drive_type());
 
      if (
d.is_ready() == 
true) {
 
        console::write_line(
"  Volume label: {0}", 
d.volume_label());
 
        console::write_line(
"  File system: {0}", 
d.drive_format());
 
        console::write_line(
"  Available space to current user:{0, 15} bytes", 
d.available_free_space());
 
        console::write_line(
"  Total available space:          {0, 15} bytes", 
d.total_free_space());
 
        console::write_line(
"  Total size of drive:            {0, 15} bytes", 
d.total_size());
 
      }
    }
  }
};
 
 
   
 
 
◆ root_directory()
Gets the root directory of a drive. 
- Returns
 - An object that contains the root directory of the drive. 
 
 
 
◆ 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>
 
 
class program {
public:
  static auto main() {
    auto all_drives = drive_info::get_drives();
    
    for (auto d : all_drives) {
      console::write_line(
"Drive {0}", 
d.name());
 
      console::write_line(
"  Drive type: {0}", 
d.drive_type());
 
      if (
d.is_ready() == 
true) {
 
        console::write_line(
"  Volume label: {0}", 
d.volume_label());
 
        console::write_line(
"  File system: {0}", 
d.drive_format());
 
        console::write_line(
"  Available space to current user:{0, 15} bytes", 
d.available_free_space());
 
        console::write_line(
"  Total available space:          {0, 15} bytes", 
d.total_free_space());
 
        console::write_line(
"  Total size of drive:            {0, 15} bytes", 
d.total_size());
 
      }
    }
  }
};
 
 
   
 
 
◆ 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>
 
 
class program {
public:
  static auto main() {
    auto all_drives = drive_info::get_drives();
    
    for (auto d : all_drives) {
      console::write_line(
"Drive {0}", 
d.name());
 
      console::write_line(
"  Drive type: {0}", 
d.drive_type());
 
      if (
d.is_ready() == 
true) {
 
        console::write_line(
"  Volume label: {0}", 
d.volume_label());
 
        console::write_line(
"  File system: {0}", 
d.drive_format());
 
        console::write_line(
"  Available space to current user:{0, 15} bytes", 
d.available_free_space());
 
        console::write_line(
"  Total available space:          {0, 15} bytes", 
d.total_free_space());
 
        console::write_line(
"  Total size of drive:            {0, 15} bytes", 
d.total_size());
 
      }
    }
  }
};
 
 
   
 
 
◆ volume_label()
      
        
          | xtd::string xtd::io::drive_info::volume_label  | 
          ( | 
           | ) | 
           const | 
        
      
 
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>
 
 
class program {
public:
  static auto main() {
    auto all_drives = drive_info::get_drives();
    
    for (auto d : all_drives) {
      console::write_line(
"Drive {0}", 
d.name());
 
      console::write_line(
"  Drive type: {0}", 
d.drive_type());
 
      if (
d.is_ready() == 
true) {
 
        console::write_line(
"  Volume label: {0}", 
d.volume_label());
 
        console::write_line(
"  File system: {0}", 
d.drive_format());
 
        console::write_line(
"  Available space to current user:{0, 15} bytes", 
d.available_free_space());
 
        console::write_line(
"  Total available space:          {0, 15} bytes", 
d.total_free_space());
 
        console::write_line(
"  Total size of drive:            {0, 15} bytes", 
d.total_size());
 
      }
    }
  }
};
 
 
   
 
 
◆ to_string()
Returns a drive name as a string. 
- Returns
 - The name of the drive. 
 
Reimplemented from xtd::object.
 
 
◆ 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>
 
 
class program {
public:
  static auto main() {
    auto all_drives = drive_info::get_drives();
    
    for (auto d : all_drives) {
      console::write_line(
"Drive {0}", 
d.name());
 
      console::write_line(
"  Drive type: {0}", 
d.drive_type());
 
      if (
d.is_ready() == 
true) {
 
        console::write_line(
"  Volume label: {0}", 
d.volume_label());
 
        console::write_line(
"  File system: {0}", 
d.drive_format());
 
        console::write_line(
"  Available space to current user:{0, 15} bytes", 
d.available_free_space());
 
        console::write_line(
"  Total available space:          {0, 15} bytes", 
d.total_free_space());
 
        console::write_line(
"  Total size of drive:            {0, 15} bytes", 
d.total_size());
 
      }
    }
  }
};
 
 
   
 
 
◆ empty
The documentation for this class was generated from the following file: