Im trying to create a function that reads a file (preferably line by line) and use that input to fill a 2D array. Imagina having a file filled but 0's and 1's to indicate an array-position's value. You'd have something like this for example:
The function should now read each line (or even character) individually to fill in the array. I can make my code read the file and evaluate each character individually, but I don't know how to start reading a new line or how to find out if there's a new line. Since the input is in a .txt file I don't think I can simply look for a \n character, am I right?
Just to state my question clearly again: How do I make my code check for a new line when the input is read from a .txt file.
I quickly read through that thread, and I suppose that I should use getline() to well... get the lines? :p But if that is so, does that automatically pick the next line each time it's used in a loop?
Nevermind the above comment, I tried it out with a simple application and also found confirmation that it just reads till the end of the line or a specific delimiter and picks up from there the next time getline() is used.