I am currently facing a problem with this code:
auto first_open(std::find(cbegin(line), cend(line), '<'));
This is the overall code:
class DLNA
{
public:
std::string IPAddress;
auto createMap()
{
std::cout << "opening file" << std::endl;
std::ifstream myfile("newcontent.xml");
std::cout << "checking file state" << std::endl;
if (myfile.is_open())
{
std::cout << "file is open" << std::endl;
std::map<std::string, val_t> varmap;
varmap["IPAddress"] = &IPAddress;
std::cout << "reference assigned" << std::endl;
std::vector<std::string> lines;
while(myfile.good())
{
std::string line;
getline(myfile,line, '\r');
lines.push_back(line);
}
std::cout << "lines size is: " << lines.size() << std::endl;
for(const std::string& line : lines)
{
std::cout << "reading line:" << std::endl << line << std::endl;
if((line.find("<") != std::string::npos) && (line.find(">")!= std::string::npos))
{
std::cout << "brackets found" << std::endl;
auto first_open(std::find(cbegin(line), cend(line), '<'));
}
}
}
}
Basically, line is just a line from a xml file and will look something like this:
<IPAddress> 123.45.67 </IPAddress>
I am compiling this program like this:
c++ -I boost_1_59_0 anothertry.cpp -o variant -std=c++1y
Any reason why this isn't working?
Thanks.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire