user1227372
user1227372

Reputation: 35

Writing c++ output into xlsx file

I have a certain function in my c++ code which compares 2 .bmp files( a reference file is compared with almost 100 files in another directory one at a time), bit by bit and reports the bit errors properly when run a in terminal window. The function that does that is as follows :

 void getBitErrors(char *filename, char *dirName, int height, int width){

DIR *dir;
struct dirent *ent;
//char *f = "";
    dir = opendir (dirName);
if (dir != NULL) {
    /* print all the files and directories within directory */
    while ((ent = readdir (dir)) != NULL) {
        if(strcmp(ent->d_name,".") && strcmp(ent->d_name,".."))
        {
              char f[255]="";
          strcat(f,dirName);
          strcat(f,ent->d_name);    
              printf ("reading image file %s\n", f);
          cout<<"Bit Error "<<getBitError(filename,f,height,width)<<endl;
        }
       }
       closedir (dir);
 } 
else {
perror ("");
    }
}

I wish to have a function in my code that writes the 100 respective comparison values into an xlsx/obs file .(As opposed to having the output displayed by std::cout in a terminal window.) I have looked into 2 different options . 1) Self explanatory libXL which is a paid library and I dont really have a $199 to pay for this library. 2) SimpleXlsx which is slightly hazy. I would be awfully obliged if someone were to explain to me how i could go about achieving my result. OS : Linux Ubuntu 10.10 Maverick.

Upvotes: 0

Views: 2045

Answers (1)

Sidharth Mudgal
Sidharth Mudgal

Reputation: 4264

I suggest you look at the .csv (comma Separated Values) format. You can get a spreadsheet like result with that with much less complexity.

Upvotes: 3

Related Questions