Original Post
Hey everyone, I have an odd issue with my code that I have never accounted before, so am hoping for any suggestions (Where should I even look?) I am currently integrating my new TER codec into my engine. In this process, it is now using my engines file manager. (Which uses std::fstream) The problem is that the stream (std::fstream) is failing to retrieve data from the file! Perhaps code can explain it better then I can... This is problem number 1. Right after fstream::seekg(), the failbit is set. What can cause the failbit to get set here? If we exclude this line, and just read from it... (We should be at the beginning of the file, anyway): ...Then the eof bit is set instead. (??) I can provide more information if needed, I would like to here, except I dont know where else to search for this one. :/ I cannot read anything but garbage with these error bits getting set for unkown reasons, so cannot proceed further until I get this resolved. I can post more code if needed (Please let me know what areas you would like to see. I cannot post the entire code here, as it is way to big.) Here is the full routine at where the error is: I am certain the stream is good (as the good bit IS set) Thanks for any help of any kind. Kind and best wishes for this holiday season as well![cool]
std::fstream* stream = rkFile.GetStream(); // This is okay and works well.
// Everything is good. We want to begin reading, so move to the beginning of the
// file (Its a binary file):
stream->seekg (0, std::ios_base::beg);
rkHeader.m_magic[0] = stream->peek();
Kernel::File& operator >> ( _in Kernel::File& rkFile, _out TER_Header& rkHeader) {
Kernel::g_EvehLog << Kernel::LogLevel (Kernel::INFO) << "...Reading TER Header information..." << std::endl;
std::fstream* stream = rkFile.GetStream();
// Everything is good here...
stream->seekg (0, std::ios_base::beg);
// After the above, the fail bit is now set :/
return rkFile;
}