Use tellg instead of std::distance to get the file size.

Since std::distance increments the |begin| iterator until |end| is
reached, std::copy would not have any data left to read.
Additionally, this way the file doesn't have to be read if it's too
big for the chip's memory anyway.
Merge pull request #10 from Ventero/fileread

Use tellg instead of std::distance to get the file size.