title: C++ Expression Must Have Class Type - String to const char*
body: <p>Trying to convert <code>string</code> to <code>const char*</code> gives "expression must have class type"
  at the bottom line. Tried some variations on converting with no luck. any ideas?   </p>
  
  <pre><code>string GetMachineID()
      {
          // LPCTSTR szHD = "C:\\";  // ERROR
          string ss;
          ss = "Err_StringIsNull";
          UCHAR szFileSys[255],
              szVolNameBuff[255];
          DWORD dwSerial;
          DWORD dwMFL;
          DWORD dwSysFlags;
          int error = 0;
  
          bool success = GetVolumeInformation(LPCTSTR("C:\\"), (LPTSTR)szVolNameBuff,
              255, &amp;dwSerial,
              &amp;dwMFL, &amp;dwSysFlags,
              (LPTSTR)szFileSys,
              255);
          if (!success)
          {
              ss = "Err_Not_Elevated";
          }
          stringstream errorStream;
          errorStream &lt;&lt; dwSerial;
          return string(errorStream.str().c_str());
      }
  
      const char *cstr = GetMachineID.c_str();
  </code></pre>