Jun 8, 2010 at 5:15pm Jun 8, 2010 at 5:15pm UTC
It's not a problem with exit. It's a matter of the stream not flushing which means its still in pending. Using std::flush instead of std::endl will give a similar and proper result.
Jun 9, 2010 at 3:23pm Jun 9, 2010 at 3:23pm UTC
but I think endl is "\n"+flush. why it doesn't work?
Jun 9, 2010 at 4:23pm Jun 9, 2010 at 4:23pm UTC
I also tried <<flush. it also doesn't work. the message only show half.
Jun 9, 2010 at 4:34pm Jun 9, 2010 at 4:34pm UTC
You should post a compilable minimal example that exhibits the problem.
And what is shown exactly anyway?
Jun 9, 2010 at 4:40pm Jun 9, 2010 at 4:40pm UTC
I'm skeptical. Take Athar's advice and compile a small test program to verify that it works.
Are you sure it doesn't have to do with _lname.front()? Is it a string? Is it null terminated? This sounds like a memory issue.
Also, what on Earth are you doing here?
if (length != np*sizeof (float )*6)
Last edited on Jun 9, 2010 at 4:41pm Jun 9, 2010 at 4:41pm UTC
Jun 9, 2010 at 8:30pm Jun 9, 2010 at 8:30pm UTC
Well, the problem is not with the code you posted, but somewhere else (invalid memory accesses or whatnot). Then again, hard to tell without even knowing what _lname is.
Jun 9, 2010 at 8:33pm Jun 9, 2010 at 8:33pm UTC
_lname is a list<string> which store many binary files' names
Jun 9, 2010 at 8:38pm Jun 9, 2010 at 8:38pm UTC
I add one file with wrong size to the list, so when the searching reach this file, the codes will execute these two lines.