Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mbed-rtos SDFileSystem11
Diff: main.cpp
- Revision:
 - 12:04af66705f1c
 - Parent:
 - 11:f9460ac84e27
 - Child:
 - 13:24238e0b812b
 
--- a/main.cpp	Mon May 03 18:44:18 2021 +0000
+++ b/main.cpp	Mon May 03 19:22:14 2021 +0000
@@ -227,8 +227,11 @@
         }
         while(!holdNotes) { //Make sure we haven't completed the note section yet
            c = fgetc(fpn); // get a character/byte from the file
-           if(c == '!') fclose(fpn);                         
-           if(c == ','){                //If the character is a comma, we have parsed the full note
+           if(c == '!'){
+                fclose(fpn);
+                holdNotes = 1;
+            }                         
+           else if(c == ','){                //If the character is a comma, we have parsed the full note
                stringstream degree(output);
                degree >> temp;         //These are weird names I got from the example code I copied
                                         // but basically this converts a string into a float
@@ -244,7 +247,10 @@
     output = "";            //Reset the output
         while(!holdStart) { //Do the same thing as above but for the start times
             c = fgetc(fpstart);
-            if(c == '!') fclose(fpstart);
+            if(c == '!'){
+                fclose(fpstart);
+                holdStart = 1;
+            }
             if(c == ','){
                 d = output.c_str();
                 num_float = std::atof(d);
@@ -260,7 +266,10 @@
     output = "";
     while(!holdFinish){         //Do the same thing as above with durations
         c = fgetc(fpfinish);
-        if(c == '!') fclose(fpfinish);
+        if(c == '!'){
+                fclose(fpfinish);
+                holdFinish = 1;
+            }
         if(c == ','){
             d = output.c_str();
             num_float = std::atof(d);