Correct, \n gives me a newline but since the flush is not there I miss out on almost all of my notifications. So I had to replace all \n with std::endl. Several osg examples has the same flaw so they should probably be changed to std::endl.
I wanted to raise this because more people could be in the same situation without knowing it. It is quite subtle but potentially dangerous IMHO. /Per On 14 July 2014 01:32, Robert Osfield <[email protected]> wrote: > Hi Per, > > I think you'll find that \n is working - it creates a newline, but just > isn't doing a flush like you want it to. For a flush you need to do use > std::endl. I believe this is appropriate std::ostream behaviour. > > Robert. > > > On 9 July 2014 13:38, Per Nordqvist <[email protected]> wrote: >> >> Hi Robert & all, >> >> When I run the program below I only see notice 2+3. >> When I uncomment the 4th notice they all appear but in order 2314. >> So it seems that osg::notify waits for a std::endl to flush, but >> shouldn't \n do the job as well? >> >> (I am on xubuntu 12.04, OSG 3.0.1, OSG_NOTIFY_LEVEL=NOTICE) >> >> Thanks! >> >> Per Nordqvist >> >> -------------------------------------- >> #include <osg/Notify> >> #include <iostream> >> >> int main(int argc, char* argv[]) >> { >> osg::notify(osg::NOTICE) << "1 notify with \\n\n"; >> std::cout << "2 cout with \\n\n"; >> std::cout << "3 cout with endl" << std::endl; >> >> // uncomment to display first notice >> //osg::notify(osg::NOTICE) << "4 notify with endl" << std::endl; >> >> return 0; >> } >> -------------------------------------- >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

