This is my code:
#include <iostream>
#include <fstream>
void WriteInDB()
{
ofstream myfile;
myfile.open ("result.txt");
for(int i=0;i<512;i++)
{
if(strcmp(filelist[i],"")!=0)
myfile << filelist[i]<<"\n";
}
myfile.close();
}
When I compile this program, I get the following errors:
Error 14 error C2228: left of '.open' must have class/struct/union
Error 17 error C2228: left of '.close' must have class/struct/union
Error 11 error C2146: syntax error : missing ';' before identifier 'myfile'
Error 10 error C2065: 'ofstream' : undeclared identifier Error 12 error C2065: 'myfile' : undeclared identifier
Error 13 error C2065: 'myfile' : undeclared identifier
Error 15 error C2065: 'myfile' : undeclared identifier
Error 16 error C2065: 'myfile' : undeclared identifier
Can anybody help me to resolve them?