I am trying to write a matrix to a file with the above code. But i got the following error:
‘ios’ : is not a class or namespace name. My code:
std::ofstream myfile;
myfile.open ("C:/Users/zenitis/Desktop/bots/Nova/data/ownStatus.txt", ios::out | ios::app);
for (int i = 0; i< 21; i++){
myfile << featureMatrix[i] << " ";
}
myfile << "\n";
myfile.close();
Any idea about this problem??
iosis a member ofstd. That is, you want to use one of the following approaches to refer to it:BTW, you can
open()thestd::ofstreamdirectly in the constructor. Also, forstd::ofstreamthe flagstd::ios_base::out(the opening flags are actually defined instd::ios‘s base classstd::ios_base) is added automatically.