I am trying to access my systems temperature using this: http://www.alcpu.com/CoreTemp/developers.html
as you can see, the data structure is this:
typedef struct core_temp_shared_data
{
unsigned int uiLoad[256];
unsigned int uiTjMax[128];
unsigned int uiCoreCnt;
unsigned int uiCPUCnt;
float fTemp[256];
float fVID;
float fCPUSpeed;
float fFSBSpeed;
float fMultiplier;
char sCPUName[100];
unsigned char ucFahrenheit;
unsigned char ucDeltaToTjMax;
}CORE_TEMP_SHARED_DATA,*PCORE_TEMP_SHARED_DATA,**PPCORE_TEMP_SHARED_DATA;
however, i am new to c++ programming and do not understand how to access the data of one of those things. i have tried this:
cout << core_temp_shared_data::fTemp;
but it just spits out this error code:
error: invalid use of non-static data member 'core_temp_shared_data::fTemp'|
what is a valid use?
Create a new object of that type, set the members to a meaningful value, and access it through the object.
core_temp_shared_data obj;
obj.fMultiplier = 0;
std::cout << obj.fMultiplier;
You need to create an instance of the struct/class like in C.
CORE_TEMP_SHARED_DATA shared_data;
shared_data.fVID = 0.5f;
Or via dynamic allocation:
PCORE_TEMP_SHARED_DATA shared_data = new CORE_TEMP_SHARED_DATA;
shared_data->fVID = 0.5f;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.