I know we can use WriteFile to write something to a file:
BOOL WINAPI WriteFile (HANDLE hFile,
LPCVOID lpBuffer,
DWORD numOfBytesToWrite,
LPDOWRD lpNumOfBytesWritten,
LPOVERLAPPED lpOverlapped);
But how can we write ASCII string to a file using this function?
Usually something like this:
You usually don’t want to do this though — unless your strings are pretty long, it’ll almost always be more efficient (i.e., faster) if you use something like
fprintforfputsto take advantage of the buffering built into the standard library.