Archived

This topic is now archived and is closed to further replies.

MarcusMaximus

Model Loading Problems

Recommended Posts

When trying to test Nehe''s model loading tutorial in VC++.net I get a runtime error saying "Invalid Allocation Size: 4294967295 bytes." This is a really big number and I have no idea why it would be trying to allocate that much. Any help would be greatly appreciated. -Mark

Share this post


Link to post
Share on other sites
that number looks suspiciously like maxint-1

is it possible that the

long fileSize = inputFile.tellg();

is returning -1, i.e. there is no spoon, sorry, file?

So I''m guessing somewhere a:

x = new Something [-1];

is happening.

lonesock

Piranha are people too.

Share this post


Link to post
Share on other sites
I might be wrong on this, but that high of a number could be because its a signed value being flipped. Check if your possably trying to allocate a negative number.

Share this post


Link to post
Share on other sites
ok i figured out for some reason
inputFile.seekg( 0, std::ios::end );
long fileSize = inputFile.tellg();

is making fileSize a negative number. Im having trouble finding out exactly which negative number but i believe it''s -1. I know the file im reading from exists, so im not sure why it''s returning a negative number. Again, any incite would be very helpful

-Mark

Share this post


Link to post
Share on other sites
WOOHOO!!! IT WORKS!!! THANKS SO MUCH FOR YOUR HELP!!! I found out i accidentally deleted the filename when i made the ifstream so there was no file. THANKS!!!

-Mark

Share this post


Link to post
Share on other sites