c - cant get libsensors to work properly -


here code concerning libsensors. libraries:

#include <unistd.h> #include <sensors/sensors.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdlib.h> #include <arpa/inet.h> #include <stdio.h> #include <string.h> #include <math.h> 

code concerning libsensors:

char sd[16384]="^\0",bf[1]; char buf2[8192]="^\0";   sensors_chip_name const* scn; int c=0; int t4=1; while((scn=sensors_get_detected_chips(0,&c))!=0) {         sensors_feature const *fea;         int f=0;         strcat(sd,scn->prefix);         printf("%s",scn->prefix);         strcat(sd,":");         strcat(sd,scn->path);         strcat(sd,"(");         while((fea=sensors_get_features(scn,&f))!=0)         {                  strcat(sd,fea->name);                 strcat(sd,"(");                 sensors_subfeature const *sb;                 int s=0;                 while((sb=sensors_get_all_subfeatures(scn,fea,&s))!=0)                 {                         t4++;                         strcat(sd,sb->name);                         strcat(sd,",");                         int t3=-1;                         int i=0;                         char t8[sizeof(sb->number)];                         memcpy(&t8,&(sb->number),sizeof(sb->number));                         strcat(sd,t8);                         strcat(sd,"!");                 }                 strcat(sd,")");         }         strcat(sd,")");  } 

so when try print nothing happens. char array called sd returns empty. seems there no sensors read.

when run sensors terminal works fine. see couple of cores , chips temps.

i implemented code post on here , frank don't totally understand it.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -