Jump to content
  • Advertisement
Sign in to follow this  
jsloan

help reading in text file

This topic is 5454 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Vectors are better than arrays because you don't need to know how many elements you'll be adding when you declare (or allocate for, in the case of pointers) them. If you know how big your array will be at compile-time, I'd generally advise to stick with arrays - they're easier to get your head around if you're new to the language for one thing, and can slow things down in some cases too.

Share this post


Link to post
Share on other sites
Advertisement
I read up on vectors a bit, i can honestly say that im confused. I dont find it necessary to use a vector for this application as my grid will always be of static size (17*17). What do you think ?

Actually i found a much better way of doing this.



struct MAP
{
int TileSrc[17][17];
};

std::ifstream fin("map.lr", ios_base::in | ios_base::binary);
fin.read((char*)map, sizeof(MAP)); //fill map array
fin.close();





after saving it in binary of course, ive already posted too much code here.

[Edited by - jsloan on September 12, 2004 3:31:57 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!