FastCRC Library C++ Interface


unsigned long Final();

Return value

The checksum.


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

After the Final method is performed, the CFastCRC32 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 CFastCRC32 object

    CFastCRC32 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;



CFastCRC32 Overview   |   Class Members   |   Useful Links   |   HashCalc


See Also    CFastCRC32::Update, SL_FCRC_ConvertToHex32 



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