Hi, i want to read each of the 4 columns stored in a .txt file separated by a space into an array of their own. The text file may have hundreds of rows so reading until the end of file is desirable.

Example:

3.4407280e+003 6.0117545e+003 8.0132664e+002 2.5292922e+003
3.4163843e+003 5.9879421e+003 7.7792044e+002 2.5058547e+003

so typically it would be array 1 containing all the rows from the first and most left column and so on..

Please help... thanks

So, what have you done in the past 16 hours to solve this? (It's been 16 hours since you posted this question). Do you need all the data in memory at the same time, or can you work with one row of data at a time? The difference is the size of array that will be needed. After you determine that, it is pretty simple to read the numbers into an array by just calling fscanf() in a loop.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.