Reading Metrics

Below is an example of how to read metrics in C

//Global our member of class
char width[256];

void load(std::string fileimage)
{
   FILE *file;
   std::string txt="";
   image = IMG_Load(fileimage.c_str());

   if (image!=NULL){
       txt=fileimage.substr(0,fileimage.length()-4);
       txt+=".dat";
       file = fopen(txt.c_str(),"rb");
       fread(&width, 256, 1, file);
       fclose(file);
   }
}