|
FastCRC Library |
API |
|
SL_FCRC32_Final
unsigned long SL_FCRCCALL SL_FCRC32_Final(
unsigned long* pCRC );
Return value
The checksum.
Parameters
pCRC
[in/out] Pointer to the
crc variable.
Remarks
Call this function to retrieve the checksum from the
crc variable pointed by
pCRC.
After the SL_FCRC32_Final function is performed, the
crc variable is initialized for new calculations, as it would be called
SL_FCRC32_Init
again.
Example
#include <stdio.h>
#include <FastCRC.h>
#define BUFF_SIZE 1024
int main()
{
FILE* file;
unsigned char buff[ BUFF_SIZE ];
unsigned long crcvar;
unsigned long checksum;
file = fopen( "c:\\Test.txt", "rb" );
if( file == NULL )
return 1;
/*****Initialize the crcvar before calling Update and Final*****************/
SL_FCRC32_Init( &crcvar );
/*****Calculate the checksum by calling Update for each block of the file***/
while( !feof( file ) )
{
unsigned int nCount = fread( buff, sizeof( char ), BUFF_SIZE, file );
SL_FCRC32_Update( &crcvar, buff, nCount );
}
/*****Do final changes and get the checksum*********************************/
checksum = SL_FCRC32_Final( &crcvar );
/*****Use the checksum******************************************************/
/*...*/
fclose( file );
return 0;
}
|
|
CRC32 API Overview
| CRC32 Functions
|
Useful Links | HashCalc
See Also
SL_FCRC32_Update,
SL_FCRC32_UpdateStr,
SL_FCRC32_Init,
SL_FCRC_ConvertToHex32
|