I have written a program to compare two 3D raw data equal or different. But I think the time consuming would be reduced if I use the STL. How to improve the program? The complete and varifiable code is showed as follows:#include <cstdio>#include <string>#include <iostream>#include <assert.h>#include <cstdlib>using namespace std;int LoadSample(std::string path_sample, unsigned char*& raw_data, int* w_h_d) {    FILE *fp;    if (  fopen_s(&fp, path_sample.c_str(),rb) )         return 1;     int width = 0;    int height = 0;    int depth = 0;    fread(&width,4,1,fp);    fread(&height,4,1,fp);    fread(&depth,4,1,fp);    w_h_d[0] = width;    w_h_d[1] = height;    w_h_d[2] = depth;    raw_data = (unsigned char*)malloc(width*height*depth*sizeof(unsigned char));    fread(raw_data,height*width*depth,1,fp);    fclose(fp);    return 0;}int CompareData(unsigned char*& data_train, int* train_w_h_d, unsigned char*& data_test, int* test_w_h_d) {    if (train_w_h_d[0] == test_w_h_d[0] && train_w_h_d[1] == test_w_h_d[1] && train_w_h_d[2] == test_w_h_d[2]) {        std::cout<< Size is equal!\n;        int all_num = train_w_h_d[0]*train_w_h_d[1]*train_w_h_d[2];        int count = 0;        for(int i = 0; i < all_num; i++) {            if(data_train[i] == data_test[i])                count++;        }        if(all_num == count)            return 1;    }    return 0;}int main(){    string root_path = F:\\SZU\\Projects\\Fetal_Face\\data\\;    string filepath_train = root_path + train\\;    string filepath_test = root_path + test\\detect_data\\;    unsigned char* data_train = NULL;    unsigned char* data_test = NULL;    int num_train = 127;    int num_test = 80;    int train_w_h_d[3] = {0, 0, 0};    int test_w_h_d[3] = {0, 0, 0};    for (int i = 0; i < num_train; i++)         for (int j = 1; j <= num_test; j++) {            char num_i[10], num_j[10];            _itoa_s(i, num_i, 10);            _itoa_s(j, num_j, 10);            std::string file_train = filepath_train + data_ + num_i + .raw;            std::string file_test = filepath_test + data_ + num_j + .raw;            if( LoadSample(file_train, data_train, train_w_h_d) )                std::cout<< Error: load train data.\n;            if ( LoadSample(file_test, data_test, test_w_h_d) )                 std::cout<< Error: load test data.\n;            if( CompareData(data_train, train_w_h_d, data_test, test_w_h_d) ) {                std::cout<< Same data:  << i << -- train\t\t << j <<  -- test\n<<std::endl;                system(PAUSE);            }            else{                std::cout<< i << -- train\t\t << j <<  -- test is difference. <<std::endl;            }            delete[] data_train;            data_train = NULL;            delete[] data_test;            data_test = NULL;    }    return 0;}The code can run correctly but I want to improve the efficiency by the STL. My compiler is VS2008.So, how to revise it? By the way, what and where is potential error or something be able to develop in my code.  
Loading and comparing files containing 3D data
c++;performance