Help with io/fstream

Is there a way to read a file for only '#' chars and store them in an arrayWall[X][Y], and do the same for '.' chars and store them in an arrayAir[X][Y]? and will I have to read from file multiple times? or can I do this all at once?

I would like to take this and turn it around and stream this to console using a gotoyx() functions DUOAS had came up with from:
http://www.cplusplus.com/forum/beginner/4234/

this is for my learning purposes only, Thanks!


gotoyx()
1
2
3
4
5
6
7
8
9
10
void gotoxy(int column, int line)
{
	COORD coord;
	coord.X = column;
	coord.Y = line;
	SetConsoleCursorPosition(
		GetStdHandle(STD_OUTPUT_HANDLE),
		coord
		);
}

Yes there's a way to do that, and Duoas' version of gotoxy() works only on windows OS(requires the inclusion of the windows.h header).

Aceix.
Thanks Aceix!

Duoas' version of gotoxy() works only on windows

That's okay because I will be the only one using it. :D

This is how I'm currently reading from file
1
2
3
4
5
6
7
string line;
while (getline(file, line))
	{
		
		_levelData.push_back(line);

	}


I need to figure out how to put this into a
int nMapArray[MAP_HEIGHT][MAP_WIDTH]

I already have writing to the screen working with a pre-build array with 1s and 0s but it takes up tones of space and I'd like to be able to read maps from files
Topic archived. No new replies allowed.