Name

crc32 Computes a running Cyclic Redundancy Check checksum.


Library

Libz.lib


Synopsis

#include <zlib.h>
uLong crc32(uLong crc, const Bytef * buf, uInt len);
 


Return Value

The crc32() function shall return the new checksum value.


Detailed Description

The crc32() function shall compute a running Cyclic Redundancy Check checksum. On entry, crc is the previous value for the checksum, and buf shall point to an array of len bytes of data to be added to this checksum. The crc32() function shall return the new checksum.

If buf is NULL (or Z_NULL), crc32() shall return the initial checksum.


Examples

To compute a running Cyclic Redundancy Check checksum for "1234":

#include <stdio.h> 
#include <zlib.h>
void Crc( )
{
     unsigned char  buffer[5]="1234";
     unsigned int i=4;
     unsigned long j=0L;
    const char hello[] = "hello, hello!";
    long crc1 = crc32(j,0, 0);
     long crc = crc32(crc1, &buffer[0], i);
    printf("crc checksum is  %x",crc);
}

Output

crc checksum is  9be3e0a3.  

Errors

None defined.


Feedback

For additional information or queries on this page send feedback


© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user.

Top