Coffeehouse Post

Single Post Permalink

View Thread: Reading int from file in C#
  • User profile image

     @kettch, your method is basically how I've been doing it but it requires more code to separate the string into the numbers I want and put them into the correct spot in the 2D array. 

    @cbae, in my case space is the delimiter. A delimiter is just some separator of data. 

    It's a txt file, an example would be like so:

    2 11 3 10
    1 9 4 6
    6 13 7 8
    5 14 15 12
    So what I want is to read int by int and put each number into my 2-dimensional array. I guess it boils 
    down to if I can do something like this in C#:

    inFile >> someInt;  // for ints seperate by space