summaryrefslogtreecommitdiff
path: root/ace/OS.cpp
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-21 03:00:24 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-21 03:00:24 +0000
commit00b14e3756b14c01e7f935f1555e55e80d258d70 (patch)
tree3836ed0c7409c0d61d7560e36cf6a198d8a7b35f /ace/OS.cpp
parent6c61dd8cc3ab390feb35862ece3b55e81c987239 (diff)
downloadATCD-00b14e3756b14c01e7f935f1555e55e80d258d70.tar.gz
Fixed unlinking temp file problem on Win32
Diffstat (limited to 'ace/OS.cpp')
-rw-r--r--ace/OS.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 521d8e1316f..7d87a8fad36 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -666,6 +666,65 @@ ACE_OS::mutex_lock_cleanup (void *mutex)
// The following *printf functions aren't inline because
// they use varargs.
#if !defined (ACE_HAS_WINCE)
+
+#if defined (ACE_WIN32)
+FILE *
+ACE_OS::fopen (const char *filename, const char *mode)
+{
+ // ACE_TRACE ("ACE_OS::fopen");
+ int hmode = _O_TEXT;
+
+ for (const char *mode_ptr = mode; *mode_ptr != 0; mode_ptr++)
+ ACE_OS::fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
+
+ ACE_HANDLE handle = ACE_OS::open (filename, hmode);
+ if (handle != ACE_INVALID_HANDLE)
+ {
+ hmode &= _O_TEXT | _O_RDONLY | _O_APPEND;
+ int fd = _open_osfhandle ((long) handle, hmode);
+ if (fd != -1)
+ {
+ FILE *fp = _fdopen (fd, mode);
+ if (fp != NULL)
+ return fp;
+ _close (fd);
+ }
+ ACE_OS::close (handle);
+ }
+ return NULL;
+}
+
+FILE *
+ACE_OS::fopen (const wchar_t *filename, const wchar_t *mode)
+{
+ // ACE_TRACE ("ACE_OS::fopen");
+ int hmode = _O_TEXT;
+
+ for (const wchar_t *mode_ptr = mode; *mode_ptr != 0; mode_ptr++)
+ ACE_OS::fopen_mode_to_open_mode_converter ((char) *mode_ptr, hmode);
+
+ ACE_HANDLE handle = ACE_OS::open (filename, hmode);
+# if defined (ACE_HAS_WINCE)
+ return handle;
+# else
+ if (handle != ACE_INVALID_HANDLE)
+ {
+ hmode &= _O_TEXT | _O_RDONLY | _O_APPEND;
+ int fd = _open_osfhandle ((long) handle, hmode);
+ if (fd != -1)
+ {
+ FILE *fp = _wfdopen (fd, mode);
+ if (fp != NULL)
+ return fp;
+ _close (fd);
+ }
+ ACE_OS::close (handle);
+ }
+ return NULL;
+# endif /* !ACE_HAS_WINCE */
+}
+# endif /* ACE_WIN32 */
+
int
ACE_OS::fprintf (FILE *fp, const char *format, ...)
{