Added some basic scanner code and usage in openfile

Reworked openfile in a couple places to make this work as expected.
Remember you'll need gcc main.c scanner.c openfile.c -o main to test.