If you format your data file in a certain way then you can directly use operator>> which is overloaded for std::istream and IloNumArray3:
#include <ilcplex/ilocplex.h>
#include <iostream>
int
main(void)
{
IloEnv env;
IloNumArray3 data(env);
std::ifstream in("data.txt");
in >> data;
for (IloInt i = 0; i < data.getSize(); ++i)
for (IloInt j = 0; j < data[i].getSize(); ++j)
for (IloInt k = 0; k < data[i][j].getSize(); ++k)
std::cout << i << ", " << ", " << j << ", " << k << ": "
<< data[i][j][k] << std::endl;
in.close();
env.end();
return 0;
}
For this to work your data file should look something like this:
[[[1, 0],
[0, 1]],
[[1, 1],
[0, 0]],
[[0, 1],
[1, 0]]]
#CPLEXOptimizers#DecisionOptimization