this library helps you for using Local File System

Files at this revision

API Documentation at this revision

Comitter:
hirokimineshita
Date:
Sat Apr 18 11:43:02 2015 +0000
Parent:
7:e62c07f356a0
Child:
9:9da7f151616a
Commit message:
2015/04/18 PM 8 be able to use int,float

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 09:31:57 2015 +0000
+++ b/lfs_useful.h	Sat Apr 18 11:43:02 2015 +0000
@@ -4,7 +4,31 @@
 /** @file
  */
 
-/** read_some function :
+/** (int)read_some function :
+ * @bref read some member of csv format document in local file and write in arrangement
+ * @param f write FILE *(name) 's name
+ * @param ar arrangement which you want to get data
+ * @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]);
+}
+
+/** (float)read_some function :
+ * @bref read some member of csv format document in local file and write in arrangement
+ * @param f write FILE *(name) 's name
+ * @param ar arrangement which you want to get data
+ * @param num the number of elements you want to get
+ */
+void read_some(FILE *f,float *ar,int num){
+    if(fgetc(f)!=',')fseek(f,-1L,SEEK_SET);
+    for(int i=0; i<num-1; i++)fscanf(f,"%f,",&ar[i]);
+    fscanf(f,"%f",&ar[num-1]);
+}
+
+/** (double)read_some function :
  * @bref read some member of csv format document in local file and write in arrangement
  * @param f write FILE *(name) 's name
  * @param ar arrangement which you want to get data