#include <iostream>
#include <vector>
#include <string>
#include <fstream>
int main()
{
std::ifstream inputFile("File.txt");
std::string wordName;
std::vector<std::string> Names;
if(inputFile)
{
while(getline(inputFile, wordName, '|'))
{
if((wordName.size()!=0))
{
Names.push_back(wordName);
}
}
}
else
{
std::cout<<"File could not be opened"<<std::endl;
}
inputFile.close();
//lets check/confirm if our vector contains all the names correct names
for(const std::string &name: Names)
{
std::cout<<name<<std::endl;
}
return 0;
}
name1|name2|name3|name4|name5|name6|name7||||||||||name8|||name10