Component Test's Software to work with "Universal Controller Box" - Software is an interpreter or "compiler" for programs to be done with a .txt file and read off of the SD Card

Dependencies:   BridgeDriver FrontPanelButtons MCP23017 SDFileSystem TextLCD mbed

Revision:
1:5731f31f96be
Parent:
0:22618cf06f45
Child:
2:3e7baa3e3fec
--- a/TextFile.h	Tue Sep 16 15:28:59 2014 +0000
+++ b/TextFile.h	Tue Sep 16 18:27:41 2014 +0000
@@ -74,18 +74,26 @@
 
 void getNextLine(FILE  *selectedFile) {
     
-    char newLine[MAX_LINE_LENGTH];
+    lineData.lineAddress = ftell(selectedFile);
+    
+    char *newLine;
+    newLine = new char[MAX_LINE_LENGTH];
+    
     fgets(newLine, MAX_LINE_LENGTH, selectedFile);
-
+    
     lineData.fullLine = newLine;    
     lineData.lineNumber++;    
     
     //Create a copy of the line, so that we don't effect the full line when we're extracting the words
-    char cpyLine[MAX_LINE_LENGTH];
+    char *cpyLine;
+    cpyLine = new char[MAX_LINE_LENGTH];
     strcpy(cpyLine, newLine);
+
+    char *tempWord;
+    tempWord = new char;
     
-    char *tempWord;
     int numWords = 0;
+    
     tempWord = strtok(cpyLine, " ");
     while (tempWord != NULL){
         strcpy(lineData.word[numWords], tempWord); //Record the word in the lineData array
@@ -93,10 +101,17 @@
         tempWord = strtok(NULL, " ");
     }
     
+    
+    
     lineData.numWords = numWords; //Record the number of words in the line
     
     lcd.setAddress(0,1);
-    lcd.printf("Current Line#: %d", lineData.lineNumber);
+    lcd.printf("Current Line#: %d ", lineData.lineNumber);
+
+    delete[] tempWord;
+    delete[] newLine;
+    delete[] cpyLine;
+    
     /*
     lcd.cls(); //clear the display   
     lcd.setAddress(0,0);