reading data from files, file name as input
<p>Hey,
I am writing a program which reads data from different files, which are given as input strings, and stores them into a vector of vectors. The problem I am not able to debug the loop which reads different files. I have closed the ifstream object, cleared the string using empty function... but still it just terminates when i give second file name as input.</p>

<p>I am copying the code for your perusal. It is a function called by another another function. Transposectr transposes a matrix.</p>

<h1>code:</h1>

<pre><code>vector&lt;vector&lt;float&gt; &gt; store1,store2;
ifstream bb;

string my_string;

float carrier;
vector&lt;float&gt; buffer;

cout&lt;&lt;"enter the file name"&lt;&lt;endl;
getline(cin,my_string);

while (my_string!="end")
</code></pre>

<p>{   </p>

<pre><code>bb.open(my_string.c_str());
while (!bb.eof())
{
 bb &gt;&gt; carrier;

 if (bb.peek() == '\n' || bb.eof() )
 {
  buffer.push_back(carrier);
  store1.push_back(buffer);
  buffer.clear();
 }

 else
 {
  buffer.push_back(carrier);
 }


}

bb.close();
buffer.clear();
transposectr1(store1);
storex.push_back(store1[1]);
storey.push_back(store1[0]);
store1.clear();
my_string.empty();
cout&lt;&lt;"done reading the file"&lt;&lt;endl;
cout&lt;&lt;"enter the file name"&lt;&lt;endl;
getline(cin,my_string);
</code></pre>

<p>}</p>
