c++ - Output file not created when running server under IMR -
i have simple corba code. has 1 simple routine write out message file. code runs fine if bring server manually. output file created expected. if add server imr , let imr takes care of start up, code won't write out out file. can tell me happening , how fix ?
void hello_impl::say_hello() throw (corba::systemexception) { cout << "hello world" << endl; char* msg = strdup ("hello world next"); ofstream out; out.open ("./mydata2.txt", std::ios::out); out << msg; out.close(); } here server code.
run (corba::orb_ptr orb) { corba::object_var poaobj = orb->resolve_initial_references("rootpoa"); portableserver::poa_var rootpoa = portableserver::poa::_narrow(poaobj); portableserver::poamanager_var manager = rootpoa->the_poamanager(); corba::policylist policylist(2); policylist.length(2); policylist[0] = rootpoa->create_lifespan_policy( portableserver::persistent); policylist[1] = rootpoa->create_id_assignment_policy( portableserver::user_id); portableserver::poa_var hellopoa = rootpoa->create_poa ("hello", manager, policylist); corba::policylist policylist; portableserver::poa_var hellopoa = rootpoa->create_poa ("hello", manager, policylist); hello_impl* helloimpl = new hello_impl(hellopoa); portableserver::servantbase_var servant = helloimpl; portableserver::objectid_var oid = portableserver::string_to_objectid("hello"); hellopoa->activate_object_with_id (oid, servant); hello_var hello = helloimpl->_this(); corba::string_var s = orb->object_to_string(hello); const char* reffile = "/tmp/hello.ref"; ofstream out (reffile); out << s << endl; out.close(); }
Comments
Post a Comment