UINT WINAPI GetSystemDirectory(
_Out_ LPTSTR lpBuffer,
_In_ UINT uSize
);
#include<Windows.h>
#include<stdio.h>
#include<stdlib.h>
int main() {
HANDLE hFile;
TCHAR buffer[MAX_PATH];
DWORD writeNum;
GetSystemDirectoryA(buffer, MAX_PATH);
hFile = CreateFile("haha.txt", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
if (!WriteFile(hFile, buffer, lstrlen(buffer), &writeNum, NULL)) {
}
return GetLastError();
}
CloseHandle(hFile);
system("pause");
return 0;
}