title: My program needs to read a text file, data in the text file needs to be seperated by commas (C++)
body: <p>I need to insert data in a search binary tree reading a text file. It works when I use spaces between the data, but it doesn't work if I use commas like I want to.
  For example I would want my text file to look like this:</p>
  
  <pre><code>New-York,c3,Luke
  London,c5,Nathan
  Toronto,c1,Jacob
    ...
  </code></pre>
  
  <p>My text file right now look like something like this:</p>
  
  <pre><code>New-York c3 Luke
  London c5 Nathan
  Toronto c1 Jacob
    ...
  </code></pre>
  
  <p>I'd also want my program not to think a space means it needs to look at the next data, only with commas.</p>
  
  <p>This is how my code looks like:</p>
  
  <pre><code>void fillTree( BinarySearchTree *b)
  {
      ifstream file;
      file.open("data.txt");
      string city;
      string tag;
      string name;
      Person p;
  
      if(!file) {
          cout&lt;&lt;"Error. " &lt;&lt; endl;
      }
  
      while(file &gt;&gt; city &gt;&gt; tag &gt;&gt; name)
      {
          p.setCity(city);
          p.setTag(tag);
          p.setName(name);
          cout &lt;&lt; p.getCity() &lt;&lt; " " &lt;&lt; p.getTag() &lt;&lt; " " &lt;&lt; p.getName() &lt;&lt; endl;
          (*b).insert(p);
      }
      file.close();
  }
  </code></pre>
  
  <p>What would I need to change in my code so I could use commmas instead of spaces? I feel like it would look more neat in the text file with commas instead of spaces.
  I'm pretty sure I'd need to edit something in this block of code, but if it could be somewhere else please let me know.</p>