And don't expect anyone here to wade through 6 screens of code.

As for the errors, don't make the mistake of really defining this stuff. You need to include the standard C header that contains these functions. (Not telling you which this is. Visual Studio's built-in help can do that.)