FastCRC Library API


unsigned long SL_FCRCCALL SL_FCRC16C_Final( unsigned long* pCRC );

Return value

The checksum.



    [in/out] Pointer to the crc variable.


Call this function to retrieve the checksum from the crc variable pointed by pCRC.

After the SL_FCRC16C_Final function is performed, the crc variable is initialized for new calculations, as it would be called SL_FCRC16C_Init again.


#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_FCRC16C_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_FCRC16C_Update( &crcvar, buff, nCount );

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

    checksum = SL_FCRC16C_Final( &crcvar );

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

    fclose( file );

    return 0;



CRC16C API Overview   |   CRC16C Functions   |   Useful Links   |   HashCalc


See Also    SL_FCRC16C_Update, SL_FCRC16C_UpdateStr, SL_FCRC16C_Init, SL_FCRC_ConvertToHex16



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