// Return the size of the file. This is a wrapper for stat. // Returns zero if the size cannot be determined or is ill-defined. streamoff _Filebuf_base::_M_file_size() { #if !defined (__ARMCC_VERSION) return _STLP_PRIV __file_size(_M_file_id); #else // armcc accepts as a paramater stdio handle so we make a special case here return _STLP_PRIV __file_size(_M_file); #endif }
streamsize stdio_istreambuf::showmanyc() { if (feof(_M_file)) return -1; else { int fd = _FILE_fd(_M_file); #ifdef _STLP_WCE (fd); // prevent warning about unused variable // not sure if i can mix win32 io mode with ftell but time will show // cannot use WIN32_IO implementation since missing stat streamsize tmp = FTELL(_M_file); FSEEK(_M_file, 0, SEEK_END); streamoff size= FTELL(_M_file)-tmp; FSEEK(_M_file, tmp, SEEK_SET); #elif defined (_STLP_USE_WIN32_IO) // in this case, __file_size works with Win32 fh , not libc one streamoff size; struct stat buf; if(FSTAT(fd, &buf) == 0 && ( _S_IFREG & buf.st_mode ) ) size = ( buf.st_size > 0 ? buf.st_size : 0); else size = 0; #else streamoff size = __file_size(fd); #endif // fbp : we can use ftell as this flavour always use stdio. streamsize pos = FTELL(_M_file); return pos >= 0 && size > pos ? size - pos : 0; } }
// Return the size of the file. This is a wrapper for stat. // Returns zero if the size cannot be determined or is ill-defined. streamoff _Filebuf_base::_M_file_size() { return _STLP_PRIV __file_size(_M_file_id); }