FastCRC Library C++ Interface


unsigned long Final();

Return value

The checksum.


Call this member function to retrieve the checksum from the CFastCRC16 object.

After the Final method is performed, the CFastCRC16 object is initialized for new calculations, as it would be constructed again.


#include <fstream>
#include <FastCRC.h>

using namespace std;
using namespace FastCRC;

const unsigned int BUFF_SIZE = 1024;

int main()
    fstream file( "c:\\test.txt", ios::in | ios::binary );

    if( !file )
        return 1;

    unsigned char buff[ BUFF_SIZE ];
    //Instantiate a CFastCRC16 object

    CFastCRC16 crcobj;

    //Calculate the checksum by calling Update for each block of the file

    while( !file.eof() )
    { ( char* )buff, BUFF_SIZE );
        crcobj.Update( buff, file.gcount() );

    //Do final changes and get the checksum

    unsigned long checksum = crcobj.Final();

    //Use the checksum

    return 0;



CFastCRC16 Overview   |   Class Members   |   Useful Links   |   HashCalc


See Also    CFastCRC16::Update, SL_FCRC_ConvertToHex16 



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