Hi All,

I have been having a difficult time trying to read space-delimited text file with unknown number of rows in C.

To be a little bit specific, say I have a space delimited integer type data with known column numbers but unknown number of rows. How do I read the text file in C and store it in a 2-d array. In addition, I want to know the number of rows in the text file to be read from. This is how my text file may look like:

data.txt (say we know it has 4 columns but number of rows unknown)
0 1 0 1
1 0 1 0
1 1 0 0
.........
.........
I would appreciate if some one can provide me source code or direct me to the relevant tutorials online if possible. Greatly appreciated!

Thanks!