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.
Diff: SavedGames/SavedGames.cpp
- Revision:
- 52:feb8cf28bcff
- Parent:
- 51:35cb8e604b72
- Child:
- 53:01be7898c23f
--- a/SavedGames/SavedGames.cpp Tue May 19 16:46:40 2020 +0000
+++ b/SavedGames/SavedGames.cpp Tue May 19 17:08:06 2020 +0000
@@ -45,8 +45,22 @@
}
}
-void SavedGames::add_saved_data(SDFileSystem &sd, struct SavedGamesData){
- FILE *fp;
+void SavedGames::add_saved_data(SDFileSystem &sd, SavedGamesData data,
+N5110 &lcd){
+ check_open_file(sd,lcd);
+
+ //opens file
+ FILE *fp;
+ fp = fopen("/sd/SavedGames.text", "a");
+
+ //Adda data to file if no error
+ if(!error_){
+ fprintf(fp, "%d\n", data.score);
+ fprintf(fp, "%d\n", data.lives);
+ fprintf(fp, "%d\n", data.smart_bombs);
+ fprintf(fp, "%d\n", data.alien_number);
+ fclose(fp);
+ }
}