this library helps you for using Local File System
Diff: lfs_useful.h
- Revision:
- 9:9da7f151616a
- Parent:
- 8:38e295ef7892
diff -r 38e295ef7892 -r 9da7f151616a lfs_useful.h --- a/lfs_useful.h Sat Apr 18 11:43:02 2015 +0000 +++ b/lfs_useful.h Mon Apr 20 08:14:05 2015 +0000 @@ -11,9 +11,12 @@ * @param num the number of elements you want to get */ void read_some(FILE *f,int *ar,int num){ - if(fgetc(f)!=',')fseek(f,-1L,SEEK_SET); - for(int i=0; i<num-1; i++)fscanf(f,"%d,",&ar[i]); - fscanf(f,"%d",&ar[num-1]); + double temp; + for(int i=0; i<num; i++){ + if(fgetc(f)!=',')fseek(f,-1L,SEEK_SET); + fscanf(f,"%lf",&temp); + ar[i]=(int)temp; + } } /** (float)read_some function :