26 #if defined(_OS_MAC_) || defined(_OS_MSDOS_) || defined(_OS_WIN32_) || defined(_OS_OS2_) 27 # define HAS_TEXT_FILEMODE // has translate/text filemode 29 #if defined(O_NONBLOCK) 30 # define HAS_ASYNC_FILEMODE 31 # define OPEN_ASYNC O_NONBLOCK 32 #elif defined(O_NDELAY) 33 # define HAS_ASYNC_FILEMODE 34 # define OPEN_ASYNC O_NDELAY 50 #if defined(__CYGWIN32_) 55 return ( _waccess( (
wchar_t*) str.
ucs2(),
t ) == 0 );
67 #if defined(CHECK_NULL) 68 qWarning(
"QFile::remove: Empty or null file name" );
72 #if defined(__CYGWIN32_) 78 return ( _wunlink( (
wchar_t*) str.
ucs2() ) == 0 );
82 #if defined(O_NONBLOCK) 83 # define HAS_ASYNC_FILEMODE 84 # define OPEN_ASYNC O_NONBLOCK 85 #elif defined(O_NDELAY) 86 # define HAS_ASYNC_FILEMODE 87 # define OPEN_ASYNC O_NDELAY 141 #if defined(CHECK_STATE) 142 qWarning(
"QFile::open: File already open" );
147 #if defined(CHECK_NULL) 148 qWarning(
"QFile::open: No file name specified" );
155 #if defined(CHECK_RANGE) 156 qWarning(
"QFile::open: File access not specified" );
180 #if defined(HAS_TEXT_FILEMODE) 184 oflags |= OPEN_BINARY;
186 #if defined(HAS_ASYNC_FILEMODE) 188 oflags |= OPEN_ASYNC;
192 #if defined(__CYGWIN32_) 197 fd = _wopen( (
wchar_t*) str.
ucs2(), oflags, 0666 );
208 bool try_create =
FALSE;
228 strcat( perm2,
"t" );
230 strcat( perm2,
"b" );
233 #if defined(__CYGWIN32_) 239 fh = _wfopen( (
wchar_t*) str.
ucs2(), (
wchar_t*) prm.
ucs2() );
242 if ( !
fh && try_create ) {
280 if (
errno == EMFILE )
318 #if defined(CHECK_RANGE) 319 qWarning(
"QFile::open: File already open" );
368 #if defined(CHECK_RANGE) 369 qWarning(
"QFile::open: File already open" );
413 #if defined(__CYGWIN32_) 418 #ifdef QT_LARGEFILE_SUPPORT 419 if ( _wstati64( (
wchar_t*) str.
ucs2(), &st ) != -1 ) {
421 if ( _wstat( (
wchar_t*) str.
ucs2(), &st ) != -1 ) {
458 #if defined(CHECK_STATE) 459 qWarning(
"QFile::at: File is not open" );
468 ok = fseek(
fh, pos, SEEK_SET) == 0;
472 #if defined(CHECK_RANGE) 474 qWarning(
"QFile::at: Cannot set file position %d", pos );
496 #if defined(CHECK_NULL) 498 qWarning(
"QFile::readBlock: Null pointer error" );
500 #if defined(CHECK_STATE) 502 qWarning(
"QFile::readBlock: File not open" );
506 qWarning(
"QFile::readBlock: Read operation not permitted" );
512 nread =
READ(
fd, p, len );
513 if ( len && nread <= 0 ) {
518 nread = fread( p, 1, len,
fh );
519 if ( (
uint)nread != len ) {
520 if ( ferror(
fh ) || nread==0 )
547 #if defined(CHECK_NULL) 548 if ( p == 0 && len != 0 )
549 qWarning(
"QFile::writeBlock: Null pointer error" );
551 #if defined(CHECK_STATE) 553 qWarning(
"QFile::writeBlock: File not open" );
557 qWarning(
"QFile::writeBlock: Write operation not permitted" );
563 nwritten =
WRITE(
fd, p, len );
565 nwritten = fwrite( p, 1, len,
fh );
566 if ( nwritten != (
int)len ) {
567 if (
errno == ENOSPC )
627 ok = fflush(
fh ) != -1;
629 ok = fclose(
fh ) != -1;
659 if (fseek(
fh, 0, SEEK_END )!=-1)
672 return fseek(
fh, pos, SEEK_SET )!=-1;
#define IO_UnspecifiedError
static void reslashify(QString &n)
bool qt_file_access(const QString &fn, int t)
int readBlock(char *data, uint len)
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
void qWarning(const char *msg,...)
int errno
Contains the last error code.
int writeBlock(const char *data, uint len)
const unsigned short * ucs2() const
static QCString encodeName(const QString &fileName)
Q_EXPORT char * qstrcpy(char *dst, const char *src)
bool isTranslated() const
bool isAsynchronous() const