Answer the question
In order to leave comments, you need to log in
Who can help with the visual code?
Good afternoon, comrades,
I'm new to programming and I ran into a problem, I can't compile the code, can you tell me why such errors occur and how to fix it in order to compile the .dll
Actually, here's the code:
#include <stdafx.h>
#include <CRC.h>
DWORD __fastcall ComputeCRC(BYTE* data, int size)
{
int crc, i;
crc = 0;
BYTE* ptr = data;
int count = size;
while (--count >= 0)
{
crc = crc ^ (int)*ptr++ << 8;
for (i = 0; i < 8; ++i)
if (crc & 0x8000)
crc = crc << 1 ^ 0x10213465;
else
crc = crc << 1;
}
return (crc & 0xFFFFFFFF);
}
DWORD __fastcall ComputeFileCRC(char* file)
{
FILE* hFile = fopen(file, "rb");
if (!hFile)
return 0;
fseek(hFile, 0, SEEK_END);
long size = ftell(hFile);
fseek(hFile, 0, SEEK_SET);
BYTE* buff = new BYTE[size];
fread(buff, 1, size, hFile);
DWORD crc = ComputeCRC(buff, size);
fclose(hFile);
delete [] buff;
return crc;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question