32 #include "dcmtk/config/osconfig.h"
33 #include "dcmtk/ofstd/oftypes.h"
34 #include "dcmtk/ofstd/ofstring.h"
35 #include "dcmtk/ofstd/ofstd.h"
37 #define INCLUDE_UNISTD
38 #define INCLUDE_CSTDIO
39 #define INCLUDE_CSTRING
40 #define INCLUDE_CSTDARG
41 #define INCLUDE_CERRNO
43 #include "dcmtk/ofstd/ofstdinc.h"
46 #ifdef HAVE_SYS_STAT_H
54 #if defined(__hpux) && defined(clearerr)
70 #ifdef _LARGEFILE64_SOURCE
73 #if !(defined(__MACH__) && defined(__APPLE__)) && !defined(__CYGWIN__)
74 #define EXPLICIT_LFS_64
78 #if defined(_WIN32) && !defined(__MINGW32__)
81 typedef __int64 offile_off_t;
82 typedef fpos_t offile_fpos_t;
84 #ifdef EXPLICIT_LFS_64
86 typedef fpos64_t offile_fpos_t;
87 typedef off64_t offile_off_t;
91 typedef off_t offile_off_t;
93 typedef long offile_off_t;
95 typedef fpos_t offile_fpos_t;
100 typedef int offile_errno_t;
139 OFBool
fopen(
const char *filename,
const char *modes)
142 #ifdef EXPLICIT_LFS_64
143 file_ = :: fopen64(filename, modes);
145 file_ = STDIO_NAMESPACE
fopen(filename, modes);
148 return (
file_ != NULL);
151 #if defined(WIDE_CHAR_FILE_IO_FUNCTIONS) && defined(_WIN32)
158 OFBool wfopen(
const wchar_t *filename,
const wchar_t *modes)
161 file_ = _wfopen(filename, modes);
163 return (
file_ != NULL);
184 return (
file_ != NULL);
196 OFBool
popen(
const char *command,
const char *modes)
200 file_ = _popen(command, modes);
205 return (
file_ != NULL);
217 OFBool
freopen(
const char *filename,
const char *modes)
219 #if defined(EXPLICIT_LFS_64) && ! defined(__MINGW32__)
226 return (
file_ != NULL);
237 #if defined(EXPLICIT_LFS_64) && ! defined(__MINGW32__)
239 file_ = :: tmpfile64();
244 return (
file_ != NULL);
262 result = _pclose(
file_);
294 size_t fwrite(
const void *ptr,
size_t size,
size_t n)
296 return STDIO_NAMESPACE
fwrite(ptr, size, n,
file_);
310 size_t fread(
void *ptr,
size_t size,
size_t n)
312 return STDIO_NAMESPACE
fread(ptr, size, n,
file_);
348 #if defined(_WIN32) || defined(__hpux)
349 this->
setvbuf(NULL, _IOLBF, 0);
377 return STDIO_NAMESPACE feof(
file_);
391 return ferror(
file_);
393 return STDIO_NAMESPACE ferror(
file_);
441 int result = STDIO_NAMESPACE
setvbuf(
file_, buf, modes, n);
462 #if defined(_WIN32) || defined(__hpux)
463 this->
setvbuf(NULL, buf ? _IOFBF : _IONBF, size);
510 int fseek(offile_off_t off,
int whence)
517 offile_fpos_t off2 = off;
530 if (_lseeki64( fileno(
file_), 0, 2) == -1)
532 if (_lseeki64(:: fileno(
file_), 0, 2) == -1)
542 if (_fstati64( fileno(
file_), &buf) == -1)
544 if (_fstati64(:: fileno(
file_), &buf) == -1)
569 #elif defined(__BEOS__)
570 result = :: _fseek(fp, offset, whence);
573 #ifdef EXPLICIT_LFS_64
574 result = :: fseeko64(
file_, off, whence);
576 result = :: fseeko(
file_, off, whence);
579 result = STDIO_NAMESPACE
fseek(
file_, off, whence);
606 #ifdef EXPLICIT_LFS_64
607 result = :: ftello64(
file_);
609 result = :: ftello(
file_);
629 #if defined(EXPLICIT_LFS_64) && ! defined(__MINGW32__)
631 result = :: fgetpos64(
file_, pos);
649 #if defined(EXPLICIT_LFS_64) && ! defined(__MINGW32__)
651 result = :: fsetpos64(
file_, pos);
668 va_start(ap, format);
714 #ifdef WIDE_CHAR_FILE_IO_FUNCTIONS
735 return STDIO_NAMESPACE fwide(
file_, mode);
746 wint_t result = STDIO_NAMESPACE fgetwc(
file_);
757 wint_t fputwc(
wchar_t wc)
759 wint_t result = STDIO_NAMESPACE fputwc(wc,
file_);
778 wint_t ungetwc(wint_t wc)
780 wint_t result = STDIO_NAMESPACE ungetwc(wc,
file_);
790 int fwprintf(
const wchar_t *format, ...)
794 va_start(ap, format);
795 result = STDIO_NAMESPACE vfwprintf(
file_, format, ap);
805 int vfwprintf(
const wchar_t *format, va_list arg)
807 return STDIO_NAMESPACE vfwprintf(
file_, format, arg);