• c++ 输出文件


    HANDLE hFile = ::CreateFile(_T("c:\\0123.txt"), //创建文件的名称。
                                                GENERIC_WRITE|GENERIC_READ, // 写和读文件。
                                                0,                                        // 不共享读写。
                                                NULL,                                  // 缺省安全属性。
                                                CREATE_ALWAYS,               // 如果文件存在,也创建。
                                                FILE_ATTRIBUTE_NORMAL, // 一般的文件。
                                                NULL);                                // 模板文件为空。

    if (hFile == INVALID_HANDLE_VALUE)
    {
    //
    OutputDebugString(_T("CreateFile fail!\r\n"));
    }

    DWORD dwWritenSize = 0;
    //::WriteFile(hFile,"1=",sizeof(CHAR)*strlen("1="),&dwWritenSize,NULL);
    ::WriteFile(hFile,lpszHookedExe,sizeof(TCHAR)*wcslen(lpszHookedExe),&dwWritenSize,NULL);
    ::WriteFile(hFile,"\r\n",sizeof(CHAR)*strlen("\r\n"),&dwWritenSize,NULL);
    FlushFileBuffers(hFile);

    //::WriteFile(hFile,"2=",sizeof(CHAR)*strlen("2="),&dwWritenSize,NULL);
    ::WriteFile(hFile,lpszDllPath,sizeof(TCHAR)*wcslen(lpszDllPath),&dwWritenSize,NULL);
    ::WriteFile(hFile,"\r\n",sizeof(CHAR)*strlen("\r\n"),&dwWritenSize,NULL);
    FlushFileBuffers(hFile);

    //::WriteFile(hFile,"3=",sizeof(CHAR)*strlen("3="),&dwWritenSize,NULL);
    ::WriteFile(hFile,lpszDetouredDllPath,sizeof(TCHAR)*wcslen(lpszDetouredDllPath),&dwWritenSize,NULL);
    //::WriteFile(hFile,"\r\n",sizeof(CHAR)*strlen("\r\n"),&dwWritenSize,NULL);
    FlushFileBuffers(hFile);

    CloseHandle(hFile);

  • 相关阅读:
    在mvc4中上传、导入和导出excel表方法总结
    ASP.NET MVC:通过 FileResult 向 浏览器 发送文件
    .net下使用NPOI读取Excel表数据
    详解免费高效实用的.NET操作Excel组件NPOI(转)
    Vue 定时执行函数
    decorators.xml的用法
    行内元素和块级元素
    C/C++中printf和C++中cout的输出格式
    IIS 搭建过程
    IIS访问共享文件详解
  • 原文地址:https://www.cnblogs.com/carl2380/p/2292568.html
Copyright © 2020-2023  润新知