Trying to convert string
to const char*
gives "expression must have class type"
at the bottom line. Tried some variations on converting with no luck. any ideas?
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, &dwSerial,
&dwMFL, &dwSysFlags,
(LPTSTR)szFileSys,
255);
if (!success)
{
ss = "Err_Not_Elevated";
}
stringstream errorStream;
errorStream << dwSerial;
return string(errorStream.str().c_str());
}
const char *cstr = GetMachineID.c_str();