GDP group 24 node core

Dependencies:   EthernetInterface SDFileSystem mbed-rtos mbed snail MbedJSONValue

Revision:
23:b57a47c7862a
Parent:
19:70c911d35e67
diff -r 835a6c6dcfbb -r b57a47c7862a sdcard.cpp
--- a/sdcard.cpp	Tue Jan 13 23:53:24 2015 +0000
+++ b/sdcard.cpp	Tue Jan 27 22:20:46 2015 +0000
@@ -16,8 +16,12 @@
     string sd_name = "/sd/";
     string sd_location ="";
     char time_s[64];
- 
-    sd_location = sd_name + data.type;
+    
+    char buffer[20];
+    sprintf(buffer, "%i", data.type);
+    string dataTypeStr = string(buffer);
+    
+    sd_location = sd_name + dataTypeStr;
     mkdir(sd_location.c_str(), 0777);
     
     sprintf(time_s, "%d", time);
@@ -27,13 +31,13 @@
     
     if (fp == NULL)
     {
-        printf("File pointer null, failed to open file\r\n");
+        printf("[SD] File pointer null, failed to open file\r\n");
     }
     
     string serializedData;
     
     for (int i = 0; i < data.readings.size(); i++)
-        fprintf(fp, "%i", data.readings[i]);
+        fprintf(fp, "%i\r\n", data.readings[i]);
     
     fclose(fp);