title: How to read txt file that include both integer and special character in C++
body: <p>i have a example.txt file like this:</p>
  <pre><code>{2,red,3}
  {4,blue,5}
  </code></pre>
  <p>So, how to read this example.txt file. I've tried:</p>
  <pre><code>ifstream ifs;
  ifs.open(&quot;example.txt&quot;);
  int x, y;
  char c;
  string color;
  for(int  i = 0; i&lt;2; i++)
  {
      ifs&gt;&gt;c&gt;&gt;x&gt;&gt;c&gt;&gt;color&gt;&gt;c&gt;&gt;y&gt;&gt;c;   // each c take { and ,
  }
  </code></pre>
  <p>But it's not work.It sound like a problem about read char variable from txt file.
  Any solution for this please. Thanks!</p>