1个回答
展开全部
//Window下,在当前目录下创建hello.txt,向其中写入一行hello, world!
#include<stdio.h>
#include<Windows.h>
#include<string.h>
int main()
{
HANDLE hFile = CreateFileA("hello.txt", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD nNumberOfBytesWritten;
WriteFile(hFile, "hello, world!", strlen("hello, world!"), &nNumberOfBytesWritten, NULL);
CloseHandle(hFile);
}
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询