Created
April 2, 2024 09:22
-
-
Save Aetopia/f13913874ce431b5a6b8f1b144627da7 to your computer and use it in GitHub Desktop.
CRTless printf implementation Win32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define printf PrintFormatA | |
DWORD PrintFormatA(LPCSTR lpFormat, ...) | |
{ | |
va_list ArgList = NULL; | |
va_start(ArgList, lpFormat); | |
CHAR szOutput[1024] = {}; | |
DWORD nNumberOfBytesToWrite = wvsprintfA(szOutput, lpFormat, ArgList); | |
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), szOutput, nNumberOfBytesToWrite, NULL, NULL); | |
va_end(ArgList); | |
return nNumberOfBytesToWrite; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment