ofstream output

B

bob

Hi,

I'm working with an ofstream object and using it to print the contents
on an 100 * 100 matrix. i.e. lots of elements. the _matrix variable
below is defined as std::vector<std::string, std::string>

When I run the code below I see the TTK_LOG( our logging function) call
correctly outputting all the values in the matrix. However I never see
anything output to the ofstream. (there's other data put into the
ofstream object elsewhere and I correctly see that). However my matrix
data never makes it.... or at least of ofstream object has a problem
somewhere along the line.

void cvs_export_container::dump(std::eek:fstream& os)
{
unsigned int x =0;
while (x < _matrix.size() )
{

unsigned int y=0;
while (y < _matrix[x].size())
{
os << _matrix[x][y] << _separator;
TTK_LOG("streamed: " << _matrix[x][y] << _separator
);
++y;
}

os <<"\n";

++x;
}

os.flush();
os.close();


Can anybody suggest what I should look for to fix the problem?

thanks much and have a nice day.

Graham
 
B

bob

Forgeddit. I found it... off by 1 bug... just before the above code
executes. The most frequent source of bugs in software apparently, and
I just let it happen to me gRRR! : )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top