Meir Yanovich
2008-05-21 12:38:43 UTC
Hello all
im using boost::shared_ptr to init std::ofstream in it
im declaring it as static :
the .h file :
typedef boost::shared_ptr<std::ofstream> OFStreamPtrType;
class Foo {
static OFStreamPtrType iStream;
}
then in the cpp file :
OFStreamPtrType Utilities::iStream(new ofstream("mylog.txt",ios::app));
Foo::printLog(string s){
if (Foo::iStream->is_open())
{
Foo::iStream << c <<".\n";
}
}
no its opening the file mylog.txt but it is not writing any thing to it
why ?
im using boost::shared_ptr to init std::ofstream in it
im declaring it as static :
the .h file :
typedef boost::shared_ptr<std::ofstream> OFStreamPtrType;
class Foo {
static OFStreamPtrType iStream;
}
then in the cpp file :
OFStreamPtrType Utilities::iStream(new ofstream("mylog.txt",ios::app));
Foo::printLog(string s){
if (Foo::iStream->is_open())
{
Foo::iStream << c <<".\n";
}
}
no its opening the file mylog.txt but it is not writing any thing to it
why ?