Home › Forums › C Programming › Help – file reading › Re: Re: Help – file reading
March 22, 2009 at 1:00 pm
#3531
Ernesto0751
Participant
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | int main ()<br /> {<br /> char matrix[20][200];<br /> int i, j, no[20], quiz_1[20], quiz_2[20], quiz_3[20], project[20], midT[20];<br /> FILE *infile;<br /> <br /> infile = fopen("studentsmark.txt","r");<br /> <br /> i=0;<br /> <br /> while( fscanf(infile,"%d %s %d %d %d %d %d",&no<i>, matrix</i><i>, &quiz_1</i><i>, &quiz_2</i><i>, &quiz_3</i><i>, &project</i><i>, &midT</i><i>) !=EOF) i++;<br /> <br /> <br /> <br /> for(j=0;j<i;j++)<br /> {<br /> printf("%d %s %d %d %d %d %dn",no[j], matrix[j], quiz_1[j], quiz_2[j], quiz_3[j], project[j], midT[j]);<br /> }<br /> <br /> fclose(infile);<br /> }#include <stdio.h><br /> <br /> <br /> int main ()<br /> {<br /> char matrix[20][200];<br /> int i, j, no[20], quiz_1[20], quiz_2[20], quiz_3[20], project[20], midT[20];<br /> FILE *infile;<br /> <br /> infile = fopen("studentsmark.txt","r");<br /> <br /> i=0;<br /> <br /> while( fscanf(infile,"%d %s %d %d %d %d %d",&no</i><i>, matrix</i><i>, &quiz_1</i><i>, &quiz_2</i><i>, &quiz_3</i><i>, &project</i><i>, &midT</i><i>) !=EOF) i++;<br /> <br /> <br /> <br /> for(j=0;j<i;j++)<br /> {<br /> printf("%d %s %d %d %d %d %dn",no[j], matrix[j], quiz_1[j], quiz_2[j], quiz_3[j], project[j], midT[j]);<br /> }<br /> <br /> fclose(infile);<br /> }</i> |
but i am unable to read tis line
No Matrix quiz1(5%) quiz1(5%) quiz1(5%) Proj(25%) MidT(20%)
what should i add to make the program read it and ignore it so it can read on the real data i need, i really have no idea…