Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ reading textfile into 2d array

Name: Anonymous 2009-12-01 14:20

Ok, anon. I am trying to teach myself C++ and one thing I would like to be able to do is read a text file that is 4 x 4 characters
xxxx
xoxx
xxox
xxxx

into a 2d char array of [4][4]

but I'm pretty confused and google seems pretty shit searching for more specific stuff like this

I can open/close files and print arrays to the screen and shit I just don't know how to assign the characters in the text file to the array.

thanks ;]

Name: Anonymous 2009-12-01 17:30

>>1
The simpler thing to do (usually) is to read a text file of 16 characters into an  array of 16 characters.

Then make a marco that transforms 2D coordinates into 1D coordinates.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List