Advertisement
JPeterson

c++ binary search

Aug 4th, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #define SIZE 8192
  2. char buf[SIZE];
  3. ..
  4. unsigned char s[] = { 0x46,0x4C,0x56 };
  5. char* pos = search(buf, buf + size, s, s + 3);
  6. if (pos < buf + size)
  7.     cerr << "match found at " << static_cast<void*>(pos) << endl;
  8. ..
  9. // match found at 0x288c3c
  10. // match found at 0x288c3c
  11. // match found at 0x288c3c
  12. // match found at 0x288c3c
  13. // match found at 0x288c3c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement