FastCRC Library API

SL_FCRC16_Final

unsigned long SL_FCRCCALL SL_FCRC16_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_FCRC16_Final function is performed, the crc variable is initialized for new calculations, as it would be called SL_FCRC16_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_FCRC16_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_FCRC16_Update( &crcvar, buff, nCount );
    }

    /*****Do final changes and get the checksum*********************************/

    checksum = SL_FCRC16_Final( &crcvar );

    /*****Use the checksum******************************************************/
    /*...*/

    fclose( file );

    return 0;
}

 

 

CRC16 API Overview   |   CRC16 Functions   |   Useful Links   |   HashCalc

 

See Also    SL_FCRC16_Update, SL_FCRC16_UpdateStr, SL_FCRC16_Init, SL_FCRC_ConvertToHex16


 

 

Send Feedback to SlavaSoft Inc. Tell a friend about FastCRC Library