I need to read with C++ a file with extension .wdx (Mathematica provided). I've been able to get the file as a .dat and .txt obtaining something like this minimal example (dummyValues.dat):
{5.12, 0.1, 0.25} {{0.10, 4, 3, 2, 1, 1.44, 10.2}} {11.1, 12.2, 13.3, 14.4, 15.5, 16.6} X
As you can see it's a mess with blank spaces and {, } symbols. I'm only interested on getting a file with numbers (decimal is indicated with dot, '.'). How can I do this through the .wdx file or the .dat?
I have tried this
#include<iostream>
#include<cmath>
#include<string>
#include"complejos.h"//'using namespace std;' command is in here
#include<fstream>
#include<iomanip>
int main() {
double dato;
char aux;
ifstream benchmarks;
benchmarks.open("dummyValues.dat");
if (benchmarks.is_open()) {//first if
benchmarks.get(aux);
while (aux != "X") {
if (aux == "{" || aux == "}" || aux == "," || aux == " ") {
benchmarks.get(aux);
} else {
benchmarks>>dato;
cout<<dato;
benchmarks.get(aux);
};
};//end of while
} else {
cout<<"ERROR: couldnt open the file"<<endl;
};//end of first if
benchmarks.close();
return 0;
}; //end of main
But I get this error:
error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
while (aux != "X") {
^~~
error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if (aux == "{" || aux == "}" || aux == "," || aux == " ") {
^~~
error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if (aux == "{" || aux == "}" || aux == "," || aux == " ") {
^~~
error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if (aux == "{" || aux == "}" || aux == "," || aux == " ") {
^~~
error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if (aux == "{" || aux == "}" || aux == "," || aux == " ") {