+-+-+
| |
+-+-+
| | |
+-+-+
Reading each of these lines in turn gives you a string, which can also be addressed as an array of characters. After reading the first line the character at
buffer[0]
is the top left corner, the character at
buffer[1]
is the North wall of the first square, and so on. Reading line two the character at
buffer[0]
is the West wall of the first square, the one at
buffer[2]
is the East, and also the West wall of the second square. Reading line 3 you are processing the South walls of the first block and the North walls of the next, and so on.
You don't need anything more than
getline()
to get and process each line of text.