I am writing an importer for a custom export script to load mesh information for models.
I tested my algo with small files, 20-30 kb of information with success, but when I try something
bigger like 400kb(not that big mind you), the file fails to open.
This is the significant code related to my issue.
void DrawEngine::LoadMeshFromLW(std::vector<CUSTOMVERTEX*> &cVertex, std::string lwFile)
{
#pragma region Declare/Initialize globals and verify stream integrity
std::fstream *importLW = new std::fstream;
std::string labelTitle;
int labelRelated = 0; //Hold information relevant to the set of data. Vertice count, face count, etc...
//TODO (labelRelated) as far as I can tell, will always be int, but might have to make string if label related information isnt an int value later in the future.
int fileSize = 0;
int faceCount = 0;
//Open file, get file size, then make sure stream pointer is put back at the beginning of the stream.
//The entire time, checking the stream to make sure everything is ok.
importLW->open(lwFile, std::ios::in);//TODO Look into std::ios::nocreate instead
if(importLW->is_open() && importLW->good())
{
importLW->seekg(0, std::ios::end);
fileSize = (int)importLW->tellg();
importLW->seekg(0, std::ios::beg);
if(importLW->tellg() != (std::ios::pos_type)0)
{
//Error- Stream position not at the beginning of file.
MessageBox(0, "Error", "Error", 0);
}
}
else
{
//Error- File open failure
MessageBox(0, "Error", "Error", 0);
}
#pragma endregion
From line 15, it jumps to line 30.
Pasting ruined format alittle bit, sorry.
Any ideas? Thanks.