this library helps you for using Local File System

Files at this revision

API Documentation at this revision

Comitter:
hirokimineshita
Date:
Mon Apr 20 08:14:05 2015 +0000
Parent:
8:38e295ef7892
Commit message:
2015/04/20 PM 5 remake (int) read_some

Changed in this revision

lfs_useful.h Show annotated file Show diff for this revision Revisions of this file
--- 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 :