#include <io.h>
#endif
-//#define DEBUG_BYTE_FILER
+#define DEBUG_BYTE_FILER
// uncomment for noisy version of class.
using namespace basis;
public:
FILE *fp; // the real file pointer.
- file_hider() : fp(NIL) {}
+ file_hider() : fp(NULL_POINTER) {}
};
//////////////
close();
_auto_close = true; // reset since we know we're opening this.
_filename->reset(fname);
-#ifndef __WIN32__
- _handle->fp = _filename->raw().t()? fopen(_filename->raw().s(), perms.s()) : NIL;
-#else
- _handle->fp = _filename->raw().t()? _wfopen((wchar_t *)(UTF16 *)transcode_to_utf16(_filename->raw()),
- (wchar_t *)(UTF16 *)transcode_to_utf16(perms)) : NIL;
-
-#ifdef DEBUG_BYTE_FILER
- if (!_handle->fp)
- wprintf((wchar_t *)(UTF16 *)transcode_to_utf16("could not open: %ls\n"),
- (wchar_t *)(UTF16 *)transcode_to_utf16(_filename->raw()));
-#endif
-
-#endif
+ _handle->fp = _filename->raw().t()? fopen(_filename->raw().s(), perms.s()) : NULL_POINTER;
+ if (_handle->fp == NULL_POINTER) return false;
return good();
}
{
_filename->reset("");
if (_auto_close && _handle->fp) fclose(_handle->fp);
- _handle->fp = NIL;
+ _handle->fp = NULL_POINTER;
}
bool byte_filer::good() { return !!_handle->fp; }