Monday 23 December 2013

Documentation and Reading in a File

I've added a lot more documentation into my program and I've started to read in a file, in this case, it's instructions.txt.

At first it wasn't working because I wasn't using try/catch but now that I've put my code into one, it builds. Now, the word "null" shows up on the screen instead of the actual instructions, which do show up in the tracing statement.

If I use an if statement that runs when null is reached, I could use break; which would stop null from being printed.

For the rest of the text, it apparently only prints the last line of it after I use if(instructionsText==null) break;

So I have to have another string variable that will store each of the lines that it prints so that it would all show up in the end when it's finished running. I put \n as well so each line is actualy showing up under the previous one instead of an ongoing line of words.

No comments:

Post a Comment