关于C++fread和fwrite问题,求帮助~!
#pragma once#define _CRT_SECURE_NO_WARNINGS
#include<Windows.h>
#include<iostream>
#define FILE_ADDRESS "F:\ipmsg1.exe"
using namespace std;
int FILE_SIZE=0;
static DWORD FILE_open(LPSTR FILE_lujing, LPVOID *FILE_BUFFER)
{
FILE *NAME = NULL;
LPVOID TEP_FILEBUFFER = NULL;
NAME=fopen(FILE_lujing, "rb");
if (!NAME)
{
cout << "打开文件失败" << endl;
return 0;
}
fseek(NAME, 0, SEEK_END);//设置指针
FILE_SIZE = ftell(NAME);
fseek(NAME, 0, SEEK_SET);//设置指针
TEP_FILEBUFFER = malloc(FILE_SIZE);
if (!TEP_FILEBUFFER)
{
cout << "分配内存空间失败" << endl;
fclose(NAME);
return 0;
}
size_t n=fread(TEP_FILEBUFFER, 1, FILE_SIZE, NAME);
FILE* FILE_NEW = fopen(FILE_ADDRESS, "wt+");
size_t y=fwrite(TEP_FILEBUFFER, 1, FILE_SIZE, FILE_NEW);
为什么读取时候和写出时文件大小不一样。用UE看有字节错位的问题,怎么回事 求大大相助