Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <iostream>
  3. #include <vector>
  4. #include <ctime>
  5. #include <string>
  6. #include <sstream>
  7.  
  8. using namespace std;
  9.  
  10.  
  11. int main(int argc, char argv[])
  12. {
  13.  
  14.  
  15. FILE *f;
  16. if (!(f = fopen("C://Users//ivolc//Downloads//card.raw", "r")))
  17. {
  18. perror("File read error\n");
  19. system("pause");
  20.  
  21. }
  22.  
  23. char ch = 0;
  24. char start, finish;
  25.  
  26. char check[7] = {0xF,0xF,0xD,0x8,0xF,0xF,0xE};
  27. for (int i = 0; i < 7; ++i)
  28. {
  29. printf("%x", check[i]);
  30. }
  31. printf("\n");
  32. int i = 0;
  33. int photo = 0;
  34. while ((ch = fgetc(f)) != EOF)
  35. {
  36. if (ch == check[i])
  37. {
  38. ++i;
  39. }
  40. else
  41. {
  42. i = 0;
  43. }
  44. if (i == 7)
  45. {
  46. ++photo;
  47. printf("quantity of photo = %d",photo);
  48. }
  49. printf("%x ", ch);
  50. }
  51.  
  52.  
  53. fclose(f);
  54. system("pause");
  55. return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement