Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Revision:
109:bb4ef6a4bd0a
Parent:
102:715f754cf5a8
Child:
111:d31b3a347e6a
--- a/src/CommandParser/cmd.cpp	Thu Sep 22 12:15:24 2016 +0000
+++ b/src/CommandParser/cmd.cpp	Thu Sep 22 14:47:35 2016 +0000
@@ -153,13 +153,16 @@
         printf("\rusage: cat <filename>\n");
         return;
     }
-    char data_buf[1024];
-    bool rc = GLOBAL_mdot->readUserFile(argv[1], data_buf, sizeof(data_buf));
-    if ( rc != true ) {
-        printf("\rFailed to read %s\n", argv[1]);
+    char *data_buf;
+    
+    mDot::mdot_file file = GLOBAL_mdot->openUserFile(argv[1], mDot::FM_RDONLY);
+    if ( file.fd < 0 ) {
         return;
     }
+    data_buf = (char *)malloc(file.size);
+    bool rc = GLOBAL_mdot->readUserFile(argv[1], data_buf, (file.size));
     printf("%s\n", data_buf);
+    free(data_buf);
 }
 /*****************************************************************************
  * Function:        cmd_help