help reading in text file

Started by
10 comments, last by jsloan 19 years, 7 months ago
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.
---PS3dev
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]

This topic is closed to new replies.

Advertisement