summaryrefslogtreecommitdiff
path: root/cppe/src/IceE/Instance.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2005-07-19 14:52:54 +0000
committerDwayne Boone <dwayne@zeroc.com>2005-07-19 14:52:54 +0000
commit98f846564089c622fcde90e377ff0b790c85d74e (patch)
treefe1952c5626a5fd2111bd033138112df74b0baef /cppe/src/IceE/Instance.cpp
parentFixed lib placement for static builds (diff)
downloadice-98f846564089c622fcde90e377ff0b790c85d74e.tar.bz2
ice-98f846564089c622fcde90e377ff0b790c85d74e.tar.xz
ice-98f846564089c622fcde90e377ff0b790c85d74e.zip
Port stderr/stdout redirection. Fixed minimal demo compile.
Diffstat (limited to 'cppe/src/IceE/Instance.cpp')
-rw-r--r--cppe/src/IceE/Instance.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/cppe/src/IceE/Instance.cpp b/cppe/src/IceE/Instance.cpp
index 1aad01e8c85..0b860a15b1a 100644
--- a/cppe/src/IceE/Instance.cpp
+++ b/cppe/src/IceE/Instance.cpp
@@ -284,13 +284,20 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope
// StdOut and StdErr redirection
//
-#ifndef _WIN32_WCE // XXX:DGB How do redirect on WinCE?
string stdOutFilename = _properties->getProperty("IceE.StdOut");
string stdErrFilename = _properties->getProperty("IceE.StdErr");
if(stdOutFilename != "")
{
- FILE* file = freopen(stdOutFilename.c_str(), "a", stdout);
+ FILE * file;
+#ifdef _WIN32_WCE
+ wchar_t* wtext = new wchar_t[sizeof(wchar_t) * stdOutFilename.length()];
+ mbstowcs(wtext, stdOutFilename.c_str(), stdOutFilename.length());
+ file = _wfreopen(wtext, L"a", stdout);
+ delete wtext;
+#else
+ file = freopen(stdOutFilename.c_str(), "a", stdout);
+#endif
if(file == 0)
{
SyscallException ex(__FILE__, __LINE__);
@@ -301,7 +308,15 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope
if(stdErrFilename != "")
{
- FILE* file = freopen(stdErrFilename.c_str(), "a", stderr);
+ FILE* file;
+#ifdef _WIN32_WCE
+ wchar_t* wtext = new wchar_t[sizeof(wchar_t) * stdErrFilename.length()];
+ mbstowcs(wtext, stdErrFilename.c_str(), stdErrFilename.length());
+ file = _wfreopen(wtext, L"a", stderr);
+ delete wtext;
+#else
+ file = freopen(stdErrFilename.c_str(), "a", stderr);
+#endif
if(file == 0)
{
SyscallException ex(__FILE__, __LINE__);
@@ -309,7 +324,6 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope
throw ex;
}
}
-#endif
unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
srand(seed);