Added dimension reading and file loading

Probably should've put it into 2 patches

Not tested fully, increasing the field size beyond file size won't work.

If no file is given it will segfault
Fixed segfault

fclose on a NULL causes a segfault

I really should clean up that function. Its alright as it is though
Tracked down funny string/NULL bug

Was checking weather the pointer exists (which it always did) when I
should've been checking if the string was NULL or not (which it was)