Hi i have a very simple code to read values from a file. However It isnt taking in all the values correctly.
Here are a list of the values i am using to read:
56
1516
211516
31121516
4112131516
511213141516
611213142516
512213141526
413213142516
412223241516
314213241516
412223241516
314213241516
412223241516
314213241516
412223241516
Would really appreciate any help you can give me, on why i am not getting these values when i read the file!
Thanks
Code:
#include <math.h>
#include <stdio.h>
int i[100000000];
int t,r;
main()
{
FILE *dat;
dat = fopen("ordered.dat","r");
r=1;
for(r=1;r<50;r++)
{
fscanf(dat,"%d",&i[r]);
printf("%d\n",i[r]);
}
}
56
1516
211516
31121516
4112131516
511213141516
611213142516
512213141526
413213142516
412223241516
314213241516
412223241516
314213241516
412223241516
314213241516
412223241516
Would really appreciate any help you can give me, on why i am not getting these values when i read the file!
Thanks
Comment