C library vs WinApi

There's nothing magical about the C library. It's just a standardized API for accessing common services from the OS. That means it's implemented on top of the OS, using the API's provided by the OS.

Use whichever makes sense in your situation. The C library is portable, Win32 isn't. On the other hand, Win32 is often more flexible, and exposes more functionality.


The functions aren't really equivalent with the exception of some simple things like ZeroMemory.

GlobalAlloc for example gives you memory, but it was used for shared memory transfer under win16 as well. Parts of this functionality still exist.

WriteFile will not only write to files but to (among others) named pipes as well. Something fwrite or write can't directly do.

I'd say use c library functions if possible and use the windows functions only if you need the extra functionality or if you get a performance improvement.

This will make porting to other platforms easier later on.