title: Why can't I pass a string into the function GetDriveTypesA()?
body: <p>So the aim of the program is to find out what drives are available and what they are. However, I cannot seem to pass a string variable straight into <code>GetDriveTypesA()</code>. But, if I just do <code>GetDriveTypesA("C:\\")</code> it works successfully.</p>
  
  <p>Please can someone help me find a solution to this problem the program is below. Thank you :)</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;windows.h&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main() {
      int i;
      int driveType;
      std::string path;
      int binary[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //To save the binary number of the GetLogicalDrives
      std::string  actualDrives[26];
      std::string letters[26] = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}; //letters of the alphabet
      DWORD drives = GetLogicalDrives(); //finds the bit mask of logical drives
  
      for(i=0; drives&gt;0; i++) { //changes the integer into a binary number
          binary[i]=drives%2;
          drives= drives/2;
      }
      for (i=0; i&lt;26; i++){ //finds out what drive letters are available
          if (binary[i]==1){
              actualDrives[i] = letters[i];
          }
      }
      for (i=0; i&lt;26; i++){ \trying to find the drive type
          if (actualDrives[i] != ""){
          cout &lt;&lt; "Actual drive:";
          cout&lt;&lt; actualDrives[i] &lt;&lt;endl;
          path = actualDrives[i] + ":\\";
          cout &lt;&lt; path &lt;&lt;endl;
          driveType = GetDriveTypeA(path); //the part of the code that does not work but does work if a string is just entered
          cout&lt;&lt; driveType &lt;&lt; endl;
          }
      }
  
  }
  </code></pre>