|
|
@ -406,6 +406,20 @@ public: |
|
|
|
return (*this); |
|
|
|
return (*this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CAutoFile& ignore(size_t nSize) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!file) |
|
|
|
|
|
|
|
throw std::ios_base::failure("CAutoFile::ignore: file handle is NULL"); |
|
|
|
|
|
|
|
unsigned char data[4096]; |
|
|
|
|
|
|
|
while (nSize > 0) { |
|
|
|
|
|
|
|
size_t nNow = std::min<size_t>(nSize, sizeof(data)); |
|
|
|
|
|
|
|
if (fread(data, 1, nNow, file) != nNow) |
|
|
|
|
|
|
|
throw std::ios_base::failure(feof(file) ? "CAutoFile::ignore: end of file" : "CAutoFile::read: fread failed"); |
|
|
|
|
|
|
|
nSize -= nNow; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return (*this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
CAutoFile& write(const char* pch, size_t nSize) |
|
|
|
CAutoFile& write(const char* pch, size_t nSize) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!file) |
|
|
|
if (!file) |
|
|
|