title: ifstreaming a file not working properly. Here is the code
body: <p>In my program i am storing data given by the user in a .txt file with the help of ofstream.
  I am using setw() to ensure proper gaping between the entered data and i am storing the data of a user in a single row. Here is the code for that:</p>
  <pre><code>string n,mn,fn;
  int a;
  cout&lt;&lt;&quot;Enter your full name: &quot;;
  getline(cin, n);
  cin.ignore();
  cout&lt;&lt;&quot;Father name: &quot;;
  getline(cin, fn);
  cin.ignore();
  cout&lt;&lt;&quot;Mother name: &quot;;
  getline(cin, mn);
  cin.ignore();
  cout&lt;&lt;&quot;Enter your age: &quot;;
  cin&gt;&gt;a;
  ofstream file(&quot;my.txt&quot;,ios::app);
  file&lt;&lt;left&lt;&lt;setw(50)&lt;&lt;n&lt;&lt;setw(50)&lt;&lt;a&lt;&lt;setw(50)&lt;&lt;fn&lt;&lt;setw(50)&lt;&lt;mn&lt;&lt;endl;
  file.close();
  </code></pre>
  <p>My .txt file saves data properly with proper spacing as:</p>
  <pre><code>parth kumar        12         jack worn        juli zeel
  standly duke       19         shane roger      zoya khan
  </code></pre>
  <p>now I want to ifstream this data in my same program. I wrote the following code to ifstream only first row. Here is the code:</p>
  <pre><code>string fn,mn,n;
  int a;
  ifstream file(&quot;my.txt&quot;);
  file&gt;&gt;left&gt;&gt;setw(50)&gt;&gt;n;
  file&gt;&gt;setw(50)&gt;&gt;a;
  file&gt;&gt;setw(50)&gt;&gt;fn;
  file&gt;&gt;setw(50)&gt;&gt;mn
  cout&lt;&lt;n&lt;&lt;&quot;   &quot;&lt;&lt;a&lt;&lt;&quot;    &quot;&lt;&lt;fn&lt;&lt;&quot;    &quot;&lt;&lt;mn;
  </code></pre>
  <p>This code is not giving desired results. I am just trying to ifstream 1st row contents.
  is it posssible? Or i should store each set of data in different file (like names in one, ages in one, father names in one, mother names in other). Can you help?</p>