Reading in a file and performing string manipulation
This code looks a little wild. I'd tame it like this:

#include &lt;algorithm&gt; // for std::remove
#include &lt;fstream&gt;   // for std::ifstream
#include &lt;string&gt;    // for std::string and std::getline
#include &lt;utility&gt;   // for std::move
#include &lt;vector&gt;    // for std::vector

std::ifstream infile("thefile.txt");    // we don't really care where you got the name from

std::vector&lt;std::string&gt; names;

for (std::string line; std::getline(infile, line, ','); )
{
    line.erase(std::remove(line.begin(), line.end(), '"'), line.end());
    names.push_back(std::move(line));
}

// done


A few points to note:


Keep it simple. Don't overthink.
Use ready-made algorithms, don't reinvent wheels (std::remove removes values).
Include what you use (std::string, std::getline).
Use algorithms, don't hand-roll your own loops. (erase/remove)
Understand what algorithms can do for you (don't hand-write your own "erase"). Get familiar with the standard library.
Don't leak scopes. The line string is only needed within the loop, and no further.
Efficiency tip: You can move from the line string that you no longer need and save yourself a copy. Also, we process everything in one step; no need to loop repeatedly.


Furthermore, I suggest factoring this logic into a file:

std::vector&lt;std::string&gt; tokenize_file(std::string const &amp; filename, char delimiter)
{
    std::vector&lt;std::string&gt; result;

    // ...

    return result;
}


Usage:

std::vector&lt;std::string&gt; names = tokenize_file("thefile.txt", ',');