I'm a bit new to this aspect of C++ (I've never done programming like this to this extent) and I believe I have a problem with variable conversions.
What I'm doing is querying the WMI service for hardware information. I followed the MSDN closely and I can have the output shown to the console.
However, I'd like to go one step further and have this output thrown into a text file instead.
The code in question is this:
VARIANT vtProp; hr = pclsObj->Get(L"Name", 0, &vtProp, 0, 0); wcout << "OS Name : " << vtProp.bstrVal; << endl;
I've never dealt with Variants before (but I believe it stored information in the form of pointers which can be converted to different types depending on the need?)
I'd like to have the above output to a text file instead. However, just using the current form of bstr (this is VB String, yes?) does not produce the desired result (I get a chain of numbers instead of the string that is displayed in the console).
IE. This doesn't work:
myfile << "OS : " <<
"OS : 0016EA2C"
How would I go about converting it to the type I need so that it outputs correctly to a text file?
Edited by aommaster, 11 August 2009 - 02:16 PM.