Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
784 B

4 years ago
  1. #ifdef DESCRIPTION
  2. *************************** DESCRIPTION ***********************************
  3. This is a header-only class for reading a binary file. About the only
  4. advantage over calling the functions directly is that this will
  5. automatically close the file when the class goes out of scope.
  6. read
  7. seek
  8. // *************************************************************************
  9. #endif // DESCRIPTION
  10. class CRead
  11. {
  12. public:
  13. CRead(PCSTR pszFileName) {
  14. hf = _lopen(pszFileName, OF_READ | OF_SHARE_DENY_WRITE);
  15. };
  16. ~CRead(void) {
  17. if (hf != HFILE_ERROR)
  18. _lclose(hf);
  19. };
  20. int read(void* pv, int cb) {
  21. return _lread(hf, pv, cb); };
  22. int seek(int offset, int origin = 0) {
  23. return _llseek(hf, offset, origin); };
  24. HFILE hf; // for those whose must have the handle
  25. };