std::shared_ptr<VersionManifest> ArchiveReader::read_manifest(){ auto stream = this->get_stream(); if (this->manifest_offset < 0){ const int uint64_length = sizeof(std::uint64_t); std::int64_t start = -uint64_length - sha256_digest_length; stream->seekg(start, std::ios::end); char temp[uint64_length]; stream->read(temp, uint64_length); if (stream->gcount() != uint64_length) throw ArchiveReadException("Invalid data: File is too small to possibly be valid"); deserialize_fixed_le_int(this->manifest_size, temp); start -= this->manifest_size; stream->seekg(start, std::ios::end); this->manifest_offset = stream->tellg(); }else stream->seekg(this->manifest_offset); { boost::iostreams::stream<BoundedInputFilter> bounded(*stream, this->manifest_size); boost::iostreams::stream<LzmaInputFilter> lzma(bounded); ImplementedDeserializerStream ds(lzma); this->version_manifest.reset(ds.begin_deserialization<VersionManifest>(config::include_typehashes)); if (!this->version_manifest) throw ArchiveReadException("Invalid data: Error during manifest deserialization"); } this->base_objects_offset = this->manifest_offset - this->version_manifest->archive_metadata.entries_size_in_archive; this->stream_ids = this->version_manifest->archive_metadata.stream_ids; this->stream_sizes = this->version_manifest->archive_metadata.stream_sizes; return this->version_manifest; }
long FileReader::FileSize(int Mode_) { long StartPos_, CurPos_, Diff_; if ((Mode_ & ios::out) || (Mode_ & ios::app)) { CurPos_ = tellp(); seekp(0); StartPos_ = tellp(); seekp(0, ios::end); Diff_ = tellp() - StartPos_; seekp(CurPos_); } else if (Mode_ & ios::in) { CurPos_ = tellg(); seekg(0); StartPos_ = tellg(); seekg(0, ios::end); Diff_ = tellg() - StartPos_; seekg(CurPos_); } return Diff_; }
void Book::Binary_search(const Key key) { size_t low = 0; size_t high = m_size_ - 1; size_t mid; BookEntry entry; while (low < high && good()) { mid = (low + high) / 2; assert(mid >= low && mid < high); // std::ios_base::beg はストリームの開始位置を指す。 // よって、ファイルの開始位置から mid * sizeof(BookEntry) バイト進んだ位置を指す。 seekg(mid * sizeof(BookEntry), std::ios_base::beg); read(reinterpret_cast<char*>(&entry), sizeof(entry)); if (key <= entry.m_key) { high = mid; } else { low = mid + 1; } } assert(low == high); seekg(low * sizeof(BookEntry), std::ios_base::beg); }
/** * Loads an object into memory. * @param i Object number to load. * @param name Preserve internal file name. * @return Pointer to the loaded object. */ char *CatFile::load(unsigned int i, bool name) { if (i >= _amount) return 0; seekg(_offset[i], std::ios::beg); unsigned char namesize = peek(); // Skip filename (if there's any) if (namesize<=56) { if (!name) { seekg(namesize + 1, std::ios::cur); } else { _size[i] += namesize + 1; } } // Read object char *object = new char[_size[i]]; read(object, _size[i]); return object; }
size_t c_disk_file::size() { auto s = dynamic_cast<std::ifstream *>(m_stream); size_t pos = s->tellg(); s->seekg (0, s->end); size_t length = s->tellg(); s->seekg (pos, s->beg); return length; }
bool NSFSoundStream::open(const std::string& fileName) { sf::Lock lock(mutex); if(!FileSystem::exists(fileName)) { return false; } int length = 0; auto fs = FileSystem::openFileRead(fileName); fs->seekg (0, std::ios::end); length = static_cast<int>(fs->tellg()); fs->seekg (0, std::ios::beg); std::unique_ptr<char[]> nsfFileBuffer(new char[length]); fs->read(nsfFileBuffer.get(), length); // To honor the contract of returning false on failure, // catch these exceptions and return false instead? Good/bad? try { gme_type_t file_type = gme_identify_extension(fileName.c_str()); if(!file_type) { return false; } for(std::size_t i = 0; i < samplerCount; ++i) { auto sampleEmu = std::shared_ptr<Music_Emu>(file_type->new_emu()); if(!sampleEmu) { return false; } // Must set sample rate before loading data handleError(sampleEmu->set_sample_rate(SAMPLE_RATE)); handleError(gme_load_data(sampleEmu.get(), nsfFileBuffer.get(), length)); sampleEmu->start_track(-1); sampleEmu->ignore_silence(false); auto sampleBuffer = std::make_shared<std::vector<short>>(masterBufferSize); std::fill(std::begin(*sampleBuffer), std::end(*sampleBuffer), 0); availableSamplers.push(std::make_pair(sampleEmu, sampleBuffer)); // sampleEmus.push_back(std::move(sampleEmu)); } trackInfo.reset(new track_info_t()); } catch(std::runtime_error& ex) { HIKARI_LOG(debug) << ex.what(); return false; } initialize(2, SAMPLE_RATE); //setCurrentTrack(0); return true; }
/* Member function ibitstream::size * ------------------------------ * Seek to file end and use tell to retrieve position. * In order to not disrupt reading, we also record cur streampos and * re-seek to there before returning. */ long ibitstream::size() { if (!is_open()) { error("Cannot get size of stream which is not open."); } clear(); // clear any error state streampos cur = tellg(); // save current streampos seekg(0, ios::end); // seek to end streampos end = tellg(); // get offset seekg(cur); // seek back to original pos return long(end); }
void ChunkManifestIngestor::IngestChunk(size_t index) const { if (index >= m_filePaths.size()) { FatalError error("ChunkManifestIngestor: chunk index out of range."); throw error; } // TODO: this library method should not print to std::cout. std::cout << " " << m_filePaths[index] << std::endl; auto input = m_fileSystem.OpenForRead(m_filePaths[index].c_str(), std::ios::binary); if (input->fail()) { std::stringstream message; message << "Failed to open chunk file '" << m_filePaths[index] << "'"; throw FatalError(message.str()); } input->seekg(0, input->end); auto length = input->tellg(); input->seekg(0, input->beg); std::vector<char> chunkData; chunkData.reserve(static_cast<size_t>(length) + 1ull); chunkData.insert(chunkData.begin(), (std::istreambuf_iterator<char>(*input)), std::istreambuf_iterator<char>()); { // Block scopes IChunkWriter. // IChunkWriter's destructor zero-terminates its output and closes its stream. std::unique_ptr<IChunkWriter> chunkWriter; if (m_chunkWriterFactory != nullptr) { chunkWriter = m_chunkWriterFactory->CreateChunkWriter(index); } ChunkIngestor processor(m_configuration, m_ingestor, m_cacheDocuments, m_filter, chunkWriter.get()); // TODO: consider std::move chunkwriter to processor. ChunkReader(&chunkData[0], &chunkData[0] + chunkData.size(), processor); } }
std::vector<std::shared_ptr<FileSystemObject>> ArchiveReader::read_base_objects(){ if (!this->version_manifest) this->read_manifest(); zekvok_assert(this->version_manifest); decltype(this->base_objects) ret; ret.reserve(this->version_manifest->archive_metadata.entry_sizes.size()); auto stream = this->get_stream(); stream->seekg(this->base_objects_offset); { boost::iostreams::stream<BoundedInputFilter> bounded(*stream, this->manifest_offset - this->base_objects_offset); std::istream *stream = &bounded; std::shared_ptr<std::istream> crypto; if (this->keypair){ CryptoPP::SecByteBlock key, iv; zekvok_assert(this->get_key_iv(key, iv, KeyIndices::FileObjectDataKey)); crypto = CryptoInputFilter::create(default_crypto_algorithm, *stream, &key, &iv); stream = crypto.get(); } boost::iostreams::stream<LzmaInputFilter> lzma(*stream); for (const auto &s : this->version_manifest->archive_metadata.entry_sizes){ boost::iostreams::stream<BoundedInputFilter> bounded2(lzma, s); ImplementedDeserializerStream ds(bounded2); std::shared_ptr<FileSystemObject> fso(ds.begin_deserialization<FileSystemObject>(config::include_typehashes)); if (!fso) throw ArchiveReadException("Invalid data: Error during FSO deserialization"); ret.push_back(fso); } } this->base_objects = std::move(ret); return this->base_objects; }
/* Member function ibitstream::rewind * --------------------------------- * Simply seeks back to beginning of file, so reading begins again * from start. */ void ibitstream::rewind() { if (!is_open()) { error("Cannot rewind stream that is not open."); } clear(); seekg(0, ios::beg); }
void ArchiveReader::read_everything(read_everything_co_t::push_type &sink){ if (!this->version_manifest) this->read_manifest(); auto ptr = this->get_stream(); auto file_data_start = this->keypair ? 4096 / 8 : 0; ptr->seekg(file_data_start); boost::iostreams::stream<BoundedInputFilter> bounded(*ptr, this->base_objects_offset - file_data_start); std::istream *stream = &bounded; std::shared_ptr<std::istream> crypto; if (this->keypair){ CryptoPP::SecByteBlock key, iv; zekvok_assert(this->get_key_iv(key, iv, KeyIndices::FileDataKey)); crypto = CryptoInputFilter::create(default_crypto_algorithm, *stream, &key, &iv); stream = crypto.get(); } boost::iostreams::stream<LzmaInputFilter> lzma(*stream); zekvok_assert(this->stream_ids.size() == this->stream_sizes.size()); for (size_t i = 0; i < this->stream_ids.size(); i++){ boost::iostreams::stream<BoundedInputFilter> bounded2(lzma, this->stream_sizes[i]); sink(std::make_pair(this->stream_ids[i], &bounded2)); //Discard left over bytes. boost::iostreams::stream<NullOutputStream> null(0); null << bounded2.rdbuf(); } }
void readFont(FontData &dst, const char *src) { auto file = std::ifstream { src, std::ifstream::in | std::ifstream::binary }; if (file.is_open()) { file.seekg(0, std::ifstream::end); dst.size = gsl::narrow_cast<uint32_t>(file.tellg()); dst.data = reinterpret_cast<uint8_t *>(gSharedHeap->alloc(dst.size)); file.seekg(0, std::ifstream::beg); file.read(reinterpret_cast<char*>(dst.data.get()), dst.size); } else { dst.size = 0; dst.data = nullptr; } }
/** * Creates a CAT file stream. A CAT file starts with an index of the * offset and size of every file contained within. Each file consists * of a filename followed by its contents. * @param path Full path to CAT file. */ CatFile::CatFile(const char *path) : std::ifstream(path, std::ios::in | std::ios::binary), _amount(0), _offset(0), _size(0) { if (!this) return; // Get amount of files read((char*)&_amount, sizeof(_amount)); #if SDL_BYTEORDER == SDL_BIG_ENDIAN _amount = (unsigned int)SDL_Swap32( _amount ); #endif _amount /= 2 * sizeof(_amount); // Get object offsets seekg(0, std::ios::beg); _offset = new unsigned int[_amount]; _size = new unsigned int[_amount]; for (unsigned int i = 0; i < _amount; ++i) { read((char*)&_offset[i], sizeof(*_offset)); #if SDL_BYTEORDER == SDL_BIG_ENDIAN _offset[i] = (unsigned int)SDL_Swap32( _offset[i] ); #endif read((char*)&_size[i], sizeof(*_size)); #if SDL_BYTEORDER == SDL_BIG_ENDIAN _size[i] = (unsigned int)SDL_Swap32( _size[i] ); #endif } }
void SQLQuery::reset() { seekg (0L,ios::beg); seekp (0L,ios::beg); parsed.erase(parsed.begin(), parsed.end()); def.clear(); clear(); }
inline void path_fstream<boost::iostreams::file_descriptor> ::fix_open_mode(std::ios_base::openmode mode) { if((mode & std::ios_base::ate) && is_open()) { seekg(0, std::ios_base::end); seekp(0, std::ios_base::end); } }
void SQLQuery::proc(SQLQueryParms& p) { seekg (0,ios::beg); seekp (0,ios::beg); char num; SQLString *ss; SQLQueryParms *c; for (vector<SQLParseElement>::iterator i = parsed.begin(); i != parsed.end(); i++) { *this << i->before; num = i->num; if (num == -1) { // do nothing } else { if (num < (int)p.size()) c = &p; else if (num < (int)def.size()) c = &def; else { *this << " ERROR"; throw SQLQueryNEParms("Not enough parameters to fill the template."); } ss = pprepare(i->option, (*c)[num], c->bound()); *this << *ss; if (ss != &(*c)[num]) delete ss; } } }
void Server::SendFile(std::pair<std::mutex*, UDPMetadata*>* _pair) { //auto mutex = &_pair->first; auto local_buffer = new char[UDP_BUFFER_SIZE]; auto metadata = _pair->second; auto file = metadata->file; while (!metadata->file->eof() && metadata->returnAllPackages || metadata->missedPackages.size() > 0) { { std::unique_lock<std::mutex> lock(*_pair->first); if (--metadata->currentDelay > 0) continue; metadata->currentDelay = metadata->delay; if (--metadata->packagesTillDrop <= 0) { //RemoveUDPClient(client); std::cout << "UDP client disconnected." << std::endl; break; //if (client == udpClients.end()) break; } /*if (metadata->missedPackages.size() > 0 ) std::cout << metadata->missedPackages.size() << std::endl;*/ if (metadata->missedPackages.size() > 0) { file->seekg(metadata->missedPackages[0] * UDP_BUFFER_SIZE); metadata->missedPackages.erase(metadata->missedPackages.begin()); } else { //file->seekg(metadata->progress); file->seekg(metadata->progress); metadata->progress += UDP_BUFFER_SIZE; } } auto packageNumber = file->tellg() / UDP_BUFFER_SIZE; std::cout << packageNumber << std::endl; file->read(local_buffer, UDP_BUFFER_SIZE); auto dataSize = file->gcount(); AddNumberToDatagram(local_buffer, dataSize, packageNumber); { std::unique_lock<std::mutex> lock(udpMutex); SendRawDataTo(_udp_socket, local_buffer, dataSize + UDP_NUMBER_SIZE, metadata->addr); } } std::cout << "UDP sending finished." << std::endl; }
std::vector<char> FileSystem::readFileAsCharBuffer(const std::string & fileName) { std::vector<char> buffer; if(exists(fileName)) { int length = 0; auto fs = openFileRead(fileName); fs->seekg (0, std::ios::end); length = static_cast<int>(fs->tellg()); fs->seekg (0, std::ios::beg); buffer.reserve(length); fs->read(&buffer[0], length); } return buffer; }
/** * Loads an object into memory. * @param i Object number to load. * @return Pointer to the loaded object. */ char *CatFile::load(unsigned int i) { if (i >= _amount) return 0; seekg(_offset[i], std::ios::beg); // Skip filename char namesize; read(&namesize, 1); seekg(namesize, std::ios::cur); // Read object char *object = new char[_size[i]]; read(object, _size[i]); return object; }
//-------------------------------------------------------------------- // @mfunc Tokenize the Provider info // // @rdesc BOOL // @flag TRUE | Parsing yielded no Error // BOOL CParseInitFile::ParseProviderInfo() { //move to beginning of file seekg(0L); CHAR* pszStart = NULL; CHAR* pszEnd = NULL; CHAR szVersion[100]; TRACE_CALL(L"PRIVLIB: CParseInitFile::ParseProviderInfo.\n"); //Skip over any lines, until the [INFO] section is reached... //Make sure the INI contains the required version (at least) if( FindSection("[INFO]")==S_OK && GetNextLine(m_pvInput, MAX_INPUT_BUFFER)==S_OK && (pszStart = strstr(m_pvInput, START_OF_TYPE)) && (pszStart = strstr(pszStart, "VERSION=")) && (pszStart = strstr(pszStart, ",")) && (pszStart = strstr(pszStart+1, ",")) && (pszEnd = strstr(pszStart+1, ",")) ) { //Build Version is between 2nd and 3rd comma. (1,50,3518,00) pszStart++; strncpy(szVersion, pszStart, (size_t)(pszEnd - pszStart)); szVersion[pszEnd - pszStart] = '\0'; ULONG ulVersion = strtoul(szVersion, NULL, 10); if(ulVersion == ULONG_MAX || ulVersion < 3518) { odtLog << "ERROR: This version of the Privlib requires a INI File generated from " << ENDL; odtLog << "ERROR: from TableDump.exe 1.50.3518.00 or later." << ENDL; return FALSE; } } else { odtLog << "ERROR: Unable to find Versioning Information in INI <File:" << m_pszFileName << ">" << ENDL; odtLog << "ERROR: This version of the Privlib requires a INI with a version section" << ENDL; odtLog << "ERROR: and generated using a version of TableDump.exe 1.50.3518.00 or later." << ENDL; return FALSE; } //Get the NextLine {(TABLE=; DEFAULTQUERY=; DATASOURCE=; USERID=; PASSWORD=; etc... )} if(GetNextLine(m_pvInput, MAX_INPUT_BUFFER)!=S_OK || (pszStart = strstr(m_pvInput, START_OF_TYPE))==NULL || (pszStart = strstr(pszStart, "TABLE="))==NULL) { odtLog << "ERROR: Unable to find InitString containing Initialization Information in INI <File:" << m_pszFileName << ">" << ENDL; odtLog << "ERROR: Make sure your using a correctly generated INI File from TableDump.exe" << ENDL; return FALSE; } //We just need to append the InitString from the FILE to the InitString //Already stored in the CModInfo from LTM. And we will parse both together... GetModInfo()->AddToInitString(pszStart); return TRUE; }
// GuessEOLType(): Attampts to determine the EOL type by // scanning the source file. Returns the old eoltype, or // or -1 if the search failed. // The search starts from the begining of the file. This will // always work unless, for some reason, there is an LF or CR // in the middle of a line. The file pointer is returned to // it's previous location once the scan is over. // Note that this code is not general, and won't must be modified // to find new EOL types (although I doubt there will be any...) int pifstream::GuessEOLType() { int oldeol = eol; int length = 0; char c; // Store the file position and jump to the start streampos oldpos = tellg(); seekg( 0, ios::beg ); // Begin Search while( good() ) { get(c); // LF Test if( c == '\n' ) { eol = LF; break; } // CR/CR+LF Test if( c == '\r' ) { get(c); if( c == '\n' ) eol = CRLF; else { eol = CR; } break; } }; // Finish up seekg( oldpos, ios::beg ); if( !good() ) return( -1 ); else return( oldeol ); }
sp<ImageSet> PCKLoader::loadShadow(Data &data, UString PckFilename, UString TabFilename, unsigned shadedIdx) { TRACE_FN; auto imageSet = mksp<ImageSet>(); auto tabFile = data.fs.open(TabFilename); if (!tabFile) { LogWarning("Failed to open tab \"%s\"", TabFilename); return nullptr; } auto pckFile = data.fs.open(PckFilename); if (!pckFile) { LogWarning("Failed to open tab \"%s\"", TabFilename); return nullptr; } imageSet->maxSize = {0, 0}; uint32_t offset = 0; unsigned idx = 0; while (tabFile.read(reinterpret_cast<char *>(&offset), sizeof(offset))) { // shadow TAB files store the offset directly pckFile.seekg(offset, std::ios::beg); if (!pckFile) { LogError("Failed to seek to offset %u", offset); return nullptr; } auto img = loadShadowImage(pckFile, shadedIdx); if (!img) { LogError("Failed to load image"); return nullptr; } imageSet->images.push_back(img); img->owningSet = imageSet; img->calculateBounds(); img->indexInSet = idx++; if (img->size.x > imageSet->maxSize.x) imageSet->maxSize.x = img->size.x; if (img->size.y > imageSet->maxSize.y) imageSet->maxSize.y = img->size.y; } LogInfo("Loaded %u images", static_cast<unsigned>(imageSet->images.size())); return imageSet; }
void AperyBook::binary_search(Key key) { size_t low = 0; size_t high = size_ - 1; size_t mid; AperyBookEntry entry; while (low < high && good()) { mid = (low + high) / 2; seekg(mid * sizeof(AperyBookEntry), std::ios_base::beg); read(reinterpret_cast<char*>(&entry), sizeof(entry)); if (key <= entry.key) high = mid; else low = mid + 1; } seekg(low * sizeof(AperyBookEntry), std::ios_base::beg); }
char * SQLQuery::preview_char() { *this << ends; #ifdef __USLC__ strstreambuf *tmpbuf = rdbuf(); uint length = tmpbuf->pcount(); #else uint length = pcount(); #endif char *s = new char[length+1]; get(s, length, '\0'); seekg (0,ios::beg); seekp (-1,ios::cur); return s; }
sp<ImageSet> PCKLoader::loadStrat(Data &data, UString PckFilename, UString TabFilename) { auto imageSet = mksp<ImageSet>(); auto tabFile = data.fs.open(TabFilename); if (!tabFile) { LogWarning("Failed to open tab \"%s\"", TabFilename); return nullptr; } auto pckFile = data.fs.open(PckFilename); if (!pckFile) { LogWarning("Failed to open tab \"%s\"", TabFilename); return nullptr; } uint32_t offset = 0; unsigned idx = 0; while (tabFile.read(reinterpret_cast<char *>(&offset), sizeof(offset))) { pckFile.seekg(offset, std::ios::beg); if (!pckFile) { LogError("Failed to seek to offset %u", offset); return nullptr; } auto img = loadStrategy(pckFile); if (!img) { LogError("Failed to load image"); return nullptr; } if (img->size != Vec2<unsigned int>{8, 8}) { LogError("Invalid size of {%d,%d} in stratmap image", img->size.x, img->size.y); return nullptr; } imageSet->images.push_back(img); img->owningSet = imageSet; img->calculateBounds(); img->indexInSet = idx++; } imageSet->maxSize = {8, 8}; LogInfo("Loaded %u images", static_cast<unsigned>(imageSet->images.size())); return imageSet; }
Stream::Stream(const std::string& fileName) { auto s = std::make_unique<std::ifstream>(); s->open(fileName, std::ios::in | std::ios::binary | std::ios::ate); if (!*s) { LOG_ERROR("Lvl file not found %s", fileName.c_str()); throw Exception("File not found"); } mSize = static_cast<size_t>(s->tellg()); s->seekg(std::ios::beg); mStream.reset(s.release()); }
void InputFile::Reset () throw () { // Gets rid of pending ungot strings while (!UngotStrings.empty()) { UngotString &us = UngotStrings.top(); delete us.first; UngotStrings.pop(); } // Resets the file get pointer clear(); seekg (0, ios::beg); CurrentLine = 1; NextChar = 0; }
// Insert a file at the given location. Shared by --insert and --add. bool insertFile(std::shared_ptr<ga::Archive> pArchive, const std::string& strLocalFile, const std::string& strArchFile, const ga::Archive::FileHandle& idBeforeThis, const std::string& type, ga::Archive::File::Attribute attr, stream::len lenReal) { // Open the file auto fsIn = std::make_unique<stream::file>(strLocalFile, false); stream::len lenSource = fsIn->size(); fsIn->seekg(0, stream::start); // Make sure either filters are active, or we've got a nonzero prefilter // length (but it's ok to have a zero prefilter length if the file is empty) assert(bUseFilters || (lenSource == 0) || (lenReal != 0)); // Create a new entry in the archive large enough to hold the file ga::Archive::FileHandle id = pArchive->insert(idBeforeThis, strArchFile, lenSource, type, attr); // Open the new (empty) file in the archive auto psNew = pArchive->open(id, bUseFilters); // Copy all the data from the file on disk into the archive file. try { stream::copy(*psNew, *fsIn); psNew->flush(); } catch (const stream::error& e) { std::cout << " [failed; " << e.what() << "]"; return false; } if (!bUseFilters) { // Since filters were skipped we will pretend we applied the filter and // we got more source data than we really did, so the next check works. lenSource = lenReal; } // If the data that went in was a different length to what we expected it // must have been compressed so update the file size (keeping the original // size as the 'uncompressed length' field.) stream::len lenActual = psNew->tellp(); if (lenActual != lenSource) { pArchive->resize(id, lenActual, lenSource); } return true; }
void Server::AddTCPClient() { auto client = Accept(); auto metadata = ExtractMetadata(ReceiveMessage(client)); auto file = new std::fstream(); try { OpenFile(file, metadata.fileName); } catch (std::runtime_error e) { SendMessage(client, e.what()); throw; } SendMessage(client, std::to_string(GetFileSize(file))); file->seekg(metadata.progress); FD_SET(client, &this->clientsSet); this->tcpClients.push_back(new std::pair<SOCKET, std::fstream*>(client, file)); std::thread thr(SendBlock, new std::pair<SOCKET, std::fstream*>(client, file)); thr.detach(); }
//-------------------------------------------------------------------- // @mfunc Fetch row data into the internal data buffer // // @rdesc HRESULT // @flag S_OK | Row Retrieved successfully // @flag S_FALSE | End of Result Set // @flag E_FAIL | Row could not be retrieved // HRESULT CParseInitFile::FetchRow(DBCOUNTITEM iRow) { TRACE_CALL(L"PRIVLIB: CParseInitFile::FetchRow.\n"); //NOTE: iRow is 1-based. //Validate arguments if(iRow == 0 || iRow > m_cRows) return E_FAIL; //Make sure we have the file open! if(!is_open()) return E_FAIL; //Seek to the current Row offset seekg((LONG)GetRowOffset(iRow)); //64bit TODO - // Retrieve the column names record return GetNextLine(m_pvInput, MAX_INPUT_BUFFER); }