SDFileSystem, slightly modified for the ExoController

Dependencies:   SDFileSystem

Dependents:   Data-Management-Honka

Fork of SDFileSystem_HelloWorld by Bradley Perry

Revision:
5:3f554866f226
Parent:
4:99e9c9e0dfb0
Child:
6:0fdda2533593
--- a/SDFile.cpp	Sat Feb 14 00:36:44 2015 +0000
+++ b/SDFile.cpp	Wed Feb 18 01:11:05 2015 +0000
@@ -8,7 +8,7 @@
 SDFile::SDFile(string path, string filename, bool readOnly)
 {
     //Creates the necessary directory
-    printf("Creating SDFile object\r\n");
+    //printf("Creating SDFile object\r\n");
     char *a = new char[path.size()+1];
     a[path.size()] = 0;
     memcpy(a,path.c_str(),path.size());
@@ -22,10 +22,10 @@
         //printf("Opening readonly file\r\n");
         //_fp = fopen((const char*)b, "r");
     } else {
-        printf("Opening writable file\r\n");
+        //printf("Opening writable file\r\n");
         _fp = fopen((const char*)b, "w+");
     }
-    printf("fp is %d\r\n", _fp);       
+    //printf("fp is %d\r\n", _fp);       
 }
 
 /**
@@ -66,14 +66,16 @@
 */
 void SDFile::write(int length, int *array)
 {
-    printf("Seeking START...\r\n");
+    //printf("Seeking START...\r\n");
     fseek(_fp, 0, SEEK_SET);
-    printf("Starting to write\r\n");
+    //printf("Starting to write\r\n");
     for(int i = 0; i < length-1; i++) {
         /* This line fails when run on testFile, reason unknown...*/
-        printf("%d\r\n", fprintf(_fp, "%04x, ", array[i]));
+        //printf("%d\r\n", fprintf(_fp, "%04x, ", array[i]));
+        fprintf(_fp, "%04x, ", array[i]);
     }
-    printf("%d\r\n", fprintf(_fp, "%04x\r\n", array[length-1]));
+//    printf("%d\r\n", fprintf(_fp, "%04x\r\n", array[length-1]));
+    fprintf(_fp, "%04x\r\n", array[length-1]);
 }
 
 void SDFile::append(int length, int *array) {
@@ -104,7 +106,7 @@
 
 void SDFile::open_for_read(string path, string filename) {
      //Creates the necessary directory
-    printf("Creating SDFile object\r\n");
+    //printf("Trying to open for read\r\n");
     char *a = new char[path.size()+1];
     a[path.size()] = 0;
     memcpy(a,path.c_str(),path.size());
@@ -116,13 +118,13 @@
     memcpy(b,fullname.c_str(),fullname.size());
     _fp = fopen((const char*)b, "r");
 
-    printf("fp is %d\r\n", _fp);  
+    //printf("fp is %d\r\n", _fp);  
 }
 
 void SDFile::open_for_write(string path, string filename) {
     
     //Creates the necessary directory
-    printf("Creating SDFile object\r\n");
+    
     char *a = new char[path.size()+1];
     a[path.size()] = 0;
     memcpy(a,path.c_str(),path.size());
@@ -134,7 +136,7 @@
     memcpy(b,fullname.c_str(),fullname.size());
             _fp = fopen((const char*)b, "w+");
 
-    printf("fp is %d\r\n", _fp); 
+    //printf("fp is %d\r\n", _fp); 
 }
 
 void SDFile::close() {