c++ - List - Strings - Textfiles -


i've got few questions concerning text files,list , strings.

i wonder if possible put in code reads text in textfile,and using "string line;" or else define each new row of text , turn of them 1 list. can sort rows, remove row or 2 or of them or search through text specific row.

in c++, you'd typically std::vector:

std::vector<std::string> data;  std::string temp;  while (std::getline(infile, temp))     data.push_back(temp); 

sorting them like:

std::sort(data.begin(), data.end()); 

deleting row n like:

data.erase(data.begin() + n); 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -