stdafx.h

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <cstdlib>

main.cpp


#include "stdafx.h" int main(int argc, char *argv[])
{
#if 0
if (argc != 3)
{
return 0;
}
std::fstream fs(argv[1], std::ios::binary | std::ios::trunc | std::ios::in | std::ios::out);
#endif
std::fstream in("D:\\axhelper.exe", std::ios::binary | std::ios::in);
if (!in.is_open())return 1;
//至文件尾获取文件大小
in.seekg(0,std::ios::end);
std::streamoff inSize = in.tellg();
std::cout << "文件大小:" <<inSize << std::endl;
//至文件头
in.seekg(0, std::ios::beg);
//分配内存
char *buff = (char*)std::calloc((size_t)inSize, sizeof(char)); //释放内存
std::free(buff);
in.close(); getchar();
//fs.read()
return 0;
}

DumpBinary的更多相关文章

随机推荐

  1. js中的 return false;

    总的来说return false 的作用就是阻止事件的默认行为 1. function check() { if(form.title.value=="") { alert(&qu ...

  2. Go环境IDE安装配置

    终于配好了自己的Go环境,每天可以来一点积累了. MAC安装配置过程参考了如下几个博文~谢谢 Intellij安装配置: http://blog.csdn.net/fenglailea/article ...

  3. IP报文格式及各字段意义

    IP数据包由报头和数据两部分组成.报头的前一部分是固定长度,共20字节.在报头的固定部分的后面是可选部分——IP选项和填充域. 首部各字段的含义如下 1.版本      占4位,指IP协议的版本. 2 ...

  4. YII2 学习

    下载地址: http://www.yiiframework.com/download/ http://www.yiichina.com/download 直接选择basic模板下载即可 下载之后解压到 ...

  5. QT学习二:工具栏

    QT  的工具栏提供 Dock 功能.文字/图标显示排列的功能. void MainWindow::createToolBar(void) { QToolBar *toolBar = new QToo ...

  6. Atitit.linq java的原理与实现 解释器模式

    Atitit.linq java的原理与实现 解释器模式 1. Linq  from  where 的实现1 2. Where expr 的实现1 3. Attilax的一点变化2 4. 解释器模式的 ...

  7. spring boot 打包报错

    [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.0.RELEASE:repac ...

  8. MySQL修改参数不重启生效

    地球人都知道,更新mysql配置my.cnf需要重启mysql才能生效,但是有些时候mysql在线上,不一定允许你重启,这时候应该怎么办呢? 看一个例子:mysql> show variable ...

  9. mock调用返回值是void类型

    //调用void方法 doNothing().when(templateWrapper).process();// doCallRealMethod().when(templateWrapper).p ...

  10. php方法重写:Declaration of should be compatible with that

    <?php// this code does trigger a strict messageerror_reporting( E_ALL | E_STRICT ); class cc exte ...