Advertisement
Guest User

TestApp.cpp

a guest
Nov 10th, 2013
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.65 KB | None | 0 0
  1. #ifndef _TESTAPP_CPP
  2. #define _TESTAPP_CPP
  3. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4. #define _CRT_SECURE_NO_WARNINGS     //Disables strcpy() security warning on Microsoft compilers.
  5. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  6.  
  7. #include <Windows.H>
  8. #include <StdIO.H>
  9. #include <StdLib.H>
  10. #include <iostream>
  11. #include <fstream>
  12. #include <string>
  13.  
  14. using namespace std;
  15.  
  16. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  17.  
  18. #include "../CCRC32.H"
  19.  
  20. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  21.  
  22. int main(int iArg, char *sArg[])
  23. {
  24.     char sSourceFile[MAX_PATH];
  25.  
  26.     memset(sSourceFile, 0, sizeof(sSourceFile));
  27.  
  28.  
  29.     CCRC32 crc32;
  30.     crc32.Initialize(); //Only have to do this once.
  31.  
  32.     unsigned int iCRC = 0;
  33.     strcpy(sSourceFile, "map.spak");
  34.     int compare = 399857339;
  35.        
  36.     ifstream checkfile(sSourceFile);
  37.     if (checkfile){
  38.  
  39.         cout << "Checking file " << sSourceFile << "..." << endl;
  40.         crc32.FileCRC(sSourceFile, &iCRC);
  41.  
  42.         if(iCRC == compare){
  43.             cout << "File " << sSourceFile << " complete!\nCRC Result: " << iCRC << endl;
  44.         }else{
  45.             cout << "File " << sSourceFile << " incomplete!\nCRC Result: " << iCRC << endl;
  46.         }
  47.     }else{
  48.         cout << "File tidak ditemukan!" << endl;
  49.     }
  50.  
  51.     system("pause");
  52.  
  53.     return 0;
  54. }
  55.  
  56. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  57. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement