Fix API deprecated warnings in provided code

Change deprecated/insecure file access APIs to their _s counterparts.
Also, there was a "&" that should have been a "&&", but thanks to dumb
luck, it was working out anyways.  Terrifying!