jordan harper
/
GameProject
Diff: main.cpp
- Revision:
- 16:6723fa6c0f25
- Parent:
- 15:cf59cdffe546
- Child:
- 17:f56dd50acf2d
--- a/main.cpp Thu Apr 30 10:53:28 2015 +0000 +++ b/main.cpp Thu Apr 30 14:44:19 2015 +0000 @@ -114,7 +114,7 @@ //frequency array for song -float frequency[]= {880,880,0,0,880,880,0,880,880,0,1047,1047,0,0,440,440,0,0,440,440,0,440,440,0,587,587,0,0,0,0,0}; +float frequency[]= {880,880,0,0,440,880,0,0,440,880,600,1047,0,0,0,0,880,880,0,0,440,880,0,0,440,880,600,587,0,0,0,0,0}; float frequency2[]= {600,600,400,400,200,0}; @@ -222,7 +222,7 @@ void menu () { int m = 0; - + char buffer[14]; // buffer used to store time string char buffer2[14]; // buffer used to store time string @@ -1078,17 +1078,16 @@ void writeDataToFile(int data) { - - FILE *fp = fopen("/local/score.txt", "w"); // open 'score.txt' for appending -// if the file doesn't exist it is created, if it exists, data is appended to the end - fprintf(fp,"%i \n",data); // print string to file - fclose(fp); // close file + char str[14]; + - FILE *fp2 = fopen ("/local/score.txt","r"); // open file for reading - data = fgetc(fp2); // read first data value - fclose(fp2); // close file - clearCells(); - lcd.printString("%i \n",0,0); + FILE *fp = fopen("/local/score.txt", "w"); // open 'score.txt' +// if the file doesn't exist it is created, if it exists, data is appended to the end + fprintf(fp,"%s",data); // print string to file + + fscanf (fp, "%s", str); + fclose(fp); // close file + lcd.printString(str,0,0); wait(3); }