I created a class:
Data::Data(char szFileName[MAX_PATH]) {
string sIn;
int i = 1;
ifstream infile;
infile.open(szFileName);
infile.seekg(0,ios::beg);
std::vector<std::string> fileRows;
while ( getline(infile,sIn ) )
{
fileRows.push_back(sIn);
}
}
after that i created this:
std::vector<std::string> Data::fileContent(){
return fileRows;
}
After that I would like to call this fileContent() somewhere, something like this:
Data name(szFileName);
MessageBox(hwnd, name.fileContent().at(0).c_str() , "About", MB_OK);
But this doesnt work... How to call this?
Adatkezeles?fileRowsas member ofData?Data::fileContent()to (a) beconst-qualified and (b) to returnstd::vector<std::string>by reference.