Similar functionality to C++ ifstream >> operator?

Moving a project from C++ to Unity. What I want to do is read text from a text file, put it into an integer and move on every time there’s a space or a new line. C#'s file reader however, reads the entire thing to a single string in one go, which I’m not even sure would work with large files (I’m thinking at least 3 times 1000x1000 data). So how would I go about doing this?

How about:
Use StreamReader.ReadLine() to read the lines. Then use string.Split(’ ') to split the individual lines into tokens and finally int.TryParse() to convert the tokens to ints. You should be able to process each line in isolation this way without having to load the whole file.

You dont have to read the whole file to a string, you can read a line and process that line. I have some code from a c# program i made of mine ages ago, here:

       StreamReader File = new StreamReader(Path); //set it up ;)
            string Section = ""; //Current section we are reading
            string line = ""; //Current line we are on

            while (!File.EndOfStream) //Loop untill there is no more
            {
                try //Just to catch errounous lines
                {
                    line = File.ReadLine().Trim(); //Trim away the nasty stuff
//Do stuff with line here
                }
            }
    catch (Exception)
            {
               //Handle an exception
                return;
            }
            finally
            {
                reader.Close(); //Close the streamreader
            }