Hi all,
My file has characters and numbers in the format given below:
#
1
2
3
4
5
#
7
10
0
-5
8
I would like to read this file in C. Now everytime '#' appears it has to read the numbers below '#' and put them in an array say x[i][j]. It should increment 'j' everytime the program comes across an integer in the file. Everytime it comes across a '#', it has to make j=0; and increment 'i' by 1. For the input given above using a file, the numbers should be put in an array as given below:
#
1 i=0 j=0
2 i=0 j=1
3 i=0 j=2
4 i=0 j=3
5 i=0 j=4
#
7 i=1 j=0
10 i=1 j=1
0 i=1 j=2
-5 i=1 j=3
8 i=1 j=4
Thanks in advance for your replies!!!
My file has characters and numbers in the format given below:
#
1
2
3
4
5
#
7
10
0
-5
8
I would like to read this file in C. Now everytime '#' appears it has to read the numbers below '#' and put them in an array say x[i][j]. It should increment 'j' everytime the program comes across an integer in the file. Everytime it comes across a '#', it has to make j=0; and increment 'i' by 1. For the input given above using a file, the numbers should be put in an array as given below:
#
1 i=0 j=0
2 i=0 j=1
3 i=0 j=2
4 i=0 j=3
5 i=0 j=4
#
7 i=1 j=0
10 i=1 j=1
0 i=1 j=2
-5 i=1 j=3
8 i=1 j=4
Thanks in advance for your replies!!!
Comment