Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Visual C# reading from file.

$
0
0

I'm using VS 2017 C# windows forms.I have a 2D array:

string[,] bigData = new string[32,25];

I'm trying to read value form txt for the array:

            string input = File.ReadAllText(@"c:\bigData.txt");
            int i = 1;
            int j = 1;
            foreach(var row in input.Split('\n'))
            {
                j = 1;
                foreach(var col in row.Trim().Split(' '))
                {
                    bigData[i,j] = col.Trim();
                    j++;
                }
                i++;
            }

(the bigdata.txt is filled with numbers)

something is bad,after reading the array is full of 0.

What is wrong?



Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>