Click here to Skip to main content
15,888,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How i can get the crc32 of a
ULONGLONG
using zlib?

What I have tried:

char * token;

char * getcrc(ULONGLONG var)
{
unsigned long crc = crc32(0, (const Bytef*)&var, sizeof(__int64));

token = new char[1000];
sprintf(token, "CRC: %u", crc);

return token;
}
Posted
Updated 12-Apr-18 6:18am
Comments
CPallini 12-Apr-18 16:15pm    
Why don't you return a unsigned long (or, at least a std::string)?

1 solution

It should work the way you are doing it. All you have to do is including zlib.h and linking your application with the zlib library.

To be correct you should use the same type for the length: sizeof(ULONGLONG).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900