fix(build): eliminate all warnings under VC10

(+) use fopen_s and factor out the routine to open a file
(+) use homemade functors instead of std::bind to workaround the
    casting to size_t issue (let me try standardize the
    static_cast<R> behavior for std::bind<R, ...>)