43 #if (defined(_OS_MAC_) && (!defined(_OS_UNIX_))) || defined(_OS_MSDOS_) || defined(_OS_WIN32_) || defined(_OS_OS2_) || defined(_OS_CYGWIN_) 44 # define HAS_TEXT_FILEMODE // has translate/text filemode 46 #if defined(O_NONBLOCK) 47 # define HAS_ASYNC_FILEMODE 48 # define OPEN_ASYNC O_NONBLOCK 49 #elif defined(O_NDELAY) 50 # define HAS_ASYNC_FILEMODE 51 # define OPEN_ASYNC O_NDELAY 69 #if defined(CHECK_NULL) 70 qWarning(
"QFile::remove: Empty or null file name" );
78 #if defined(O_NONBLOCK) 79 # define HAS_ASYNC_FILEMODE 80 # define OPEN_ASYNC O_NONBLOCK 81 #elif defined(O_NDELAY) 82 # define HAS_ASYNC_FILEMODE 83 # define OPEN_ASYNC O_NDELAY 137 #if defined(CHECK_STATE) 138 qWarning(
"QFile::open: File already open" );
143 #if defined(CHECK_NULL) 144 qWarning(
"QFile::open: No file name specified" );
151 #if defined(CHECK_RANGE) 152 qWarning(
"QFile::open: File access not specified" );
176 #if defined(HAS_TEXT_FILEMODE) 184 oflags |= OPEN_BINARY;
186 #if defined(HAS_ASYNC_FILEMODE) 188 oflags |= OPEN_ASYNC;
200 bool try_create =
FALSE;
219 #if defined(HAS_TEXT_FILEMODE) 224 strcat( perm2,
"t" );
227 strcat( perm2,
"b" );
233 if ( !
fh && try_create ) {
271 if (
errno == EMFILE )
309 #if defined(CHECK_RANGE) 310 qWarning(
"QFile::open: File already open" );
359 #if defined(CHECK_RANGE) 360 qWarning(
"QFile::open: File already open" );
406 return (
uint)st.st_size;
437 #if defined(CHECK_STATE) 438 qWarning(
"QFile::at: File is not open" );
447 ok = fseek(
fh, pos, SEEK_SET) == 0;
451 #if defined(CHECK_RANGE) 453 qWarning(
"QFile::at: Cannot set file position %d", pos );
475 #if defined(CHECK_NULL) 477 qWarning(
"QFile::readBlock: Null pointer error" );
479 #if defined(CHECK_STATE) 481 qWarning(
"QFile::readBlock: File not open" );
485 qWarning(
"QFile::readBlock: Read operation not permitted" );
501 if ( nread < (
int)len ) {
504 if ( len && nread <= 0 ) {
509 nread += (
int)fread( p, 1, len-nread,
fh );
510 if ( (
uint)nread != len ) {
511 if ( ferror(
fh ) || nread==0 )
539 #if defined(CHECK_NULL) 540 if ( p == 0 && len != 0 )
541 qWarning(
"QFile::writeBlock: Null pointer error" );
543 #if defined(CHECK_STATE) 545 qWarning(
"QFile::writeBlock: File not open" );
549 qWarning(
"QFile::writeBlock: Write operation not permitted" );
558 nwritten = (
int)fwrite( p, 1, len,
fh );
559 if ( nwritten != (
int)len ) {
560 if (
errno == ENOSPC )
620 ok = fflush(
fh ) != -1;
622 ok = fclose(
fh ) != -1;
652 if (fseek(
fh, 0, SEEK_END )!=-1)
665 return fseek(
fh, (
long)pos, SEEK_SET )!=-1;
#define IO_UnspecifiedError
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)
static QCString encodeName(const QString &fileName)
bool qt_file_access(const QString &fn, int t)
Q_EXPORT char * qstrcpy(char *dst, const char *src)
bool isTranslated() const
bool isAsynchronous() const