{"id":598,"date":"2011-06-01T10:07:32","date_gmt":"2011-06-01T10:07:32","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=598"},"modified":"2022-02-17T06:24:04","modified_gmt":"2022-02-17T06:24:04","slug":"obtaining-hard-disk-information","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/file-input-output-serialization\/obtaining-hard-disk-information","title":{"rendered":"Obtaining Hard Disk Information"},"content":{"rendered":"<pre><code>\r\nusing namespace System::IO;\r\n\r\n\ttry\r\n\t{\r\n\t\tarray&lt;DriveInfo^&gt; ^allDrives = DriveInfo::GetDrives();\r\n\r\n\t\tfor each (DriveInfo ^drive in allDrives)\r\n\t\t{\r\n\t\t\tsTemp += \"Drive Name: \" + drive-&gt;Name;\r\n\t\t\tsTemp += \", Type \" + Convert::ToString(drive-&gt;DriveType);\r\n\t\t\tif ((drive-&gt;DriveType == DriveType::Fixed) &amp;&amp; (drive-&gt;IsReady))\r\n\t\t\t{\r\n\t\t\t\tsTemp += \", Volume Label: \" + drive-&gt;VolumeLabel;\r\n\t\t\t\tsTemp += \", File System: \" + drive-&gt;DriveFormat;\r\n\r\n\t\t\t\tif (drive-&gt;TotalSize &gt;= 1073741824)\r\n\t\t\t\t\tsTemp += \", Total size: \" + Convert::ToInt64(drive-&gt;TotalSize \/ 1073741824) + \" GB\";\r\n\t\t\t\telse if (drive-&gt;TotalSize &gt;= 1048576)\r\n\t\t\t\t\tsTemp += \", Total size: \" + Convert::ToInt64(drive-&gt;TotalSize \/ 1048576) + \" MB\";\r\n\t\t\t\telse\r\n\t\t\t\t\tsTemp += \", Total size: \" + drive-&gt;TotalSize \/ 1048576 + \" bytes\";\r\n\r\n\t\t\t\tif (drive-&gt;TotalFreeSpace &gt;= 1073741824)\r\n\t\t\t\t\tsTemp += \", Total available space: \" + Convert::ToInt64(drive-&gt;TotalFreeSpace \/ 1073741824) + \" GB\";\r\n\t\t\t\telse if (drive-&gt;TotalFreeSpace &gt;= 1048576)\r\n\t\t\t\t\tsTemp += \", Total available space: \" + Convert::ToInt64(drive-&gt;TotalFreeSpace \/ 1048576) + \" MB\";\r\n\t\t\t\telse\r\n\t\t\t\t\tsTemp += \", Total available space: \" + drive-&gt;TotalFreeSpace + \" bytes\";\r\n\r\n\t\t\t\tif (drive-&gt;AvailableFreeSpace &gt;= 1073741824)\r\n\t\t\t\t\tsTemp += \", Available space to current user: \" + Convert::ToInt64(drive-&gt;AvailableFreeSpace \/ 1073741824) + \" GB\";\r\n\t\t\t\telse if (drive-&gt;AvailableFreeSpace &gt;= 1048576)\r\n\t\t\t\t\tsTemp += \", Available space to current user: \" + Convert::ToInt64(drive-&gt;AvailableFreeSpace \/ 1048576) + \" MB\";\r\n\t\t\t\telse\r\n\t\t\t\t\tsTemp += \", Available space to current user: \" + drive-&gt;AvailableFreeSpace + \" bytes\";\r\n\t\t\t}\r\n\t\t\tsTemp += \"\\r\\n\";\r\n\t\t}\r\n\t}\r\n\tcatch (Exception ^)\r\n\t{\r\n\t}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>using namespace System::IO; try { array&lt;DriveInfo^&gt; ^allDrives = DriveInfo::GetDrives(); for each (DriveInfo ^drive in allDrives) { sTemp += &#8220;Drive Name: &#8221; + drive-&gt;Name; sTemp += &#8220;, Type &#8221; + Convert::ToString(drive-&gt;DriveType); if ((drive-&gt;DriveType == DriveType::Fixed) &amp;&amp; (drive-&gt;IsReady)) { sTemp += &#8220;, Volume Label: &#8221; + drive-&gt;VolumeLabel; sTemp += &#8220;, File System: &#8221; + drive-&gt;DriveFormat; if (drive-&gt;TotalSize [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-598","post","type-post","status-publish","format-standard","hentry","category-file-input-output-serialization"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/comments?post=598"}],"version-history":[{"count":6,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/598\/revisions"}],"predecessor-version":[{"id":1046,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/598\/revisions\/1046"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}