Source code of Windows XP (NT5)
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.

45 lines
1.2 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File: ccsv.h
  4. //
  5. // Module: CMPBK32.DLL
  6. //
  7. // Synopsis: Definition of the CCSVFile class.
  8. //
  9. // Copyright (c) 1998 Microsoft Corporation
  10. //
  11. // Author: quintinb created header 08/17/99
  12. //
  13. //+----------------------------------------------------------------------------
  14. #ifndef _CCSV_INC_
  15. #define _CCSV_INC_
  16. #define CCSVFILE_BUFFER_SIZE 2*512
  17. // simple file i/o for phone books
  18. class CCSVFile
  19. {
  20. public:
  21. CCSVFile();
  22. ~CCSVFile();
  23. BOOLEAN Open(LPCSTR pszFileName);
  24. BOOLEAN ReadToken(char *pszDest, DWORD cbMax); // reads up to comma or newline, returns fFalse on EOF
  25. BOOL ClearNewLines(void); // reads through newlines, returns FALSE on EOF
  26. BOOL ReadError(void); // true if last read failed
  27. void Close(void);
  28. private:
  29. BOOL m_fReadFail;
  30. BOOL m_fUseLastRead;
  31. BOOL FReadInBuffer(void);
  32. inline WORD ChNext(void);
  33. char m_rgchBuf[CCSVFILE_BUFFER_SIZE]; //buffer
  34. char *m_pchBuf; //pointer to the next item in the buffer to read
  35. char *m_pchLast; //pointer to the last item in the buffer
  36. char m_chLastRead; //the character last read. HIBYTE=err code, LOBYTE=char
  37. DWORD m_cchAvail;
  38. HANDLE m_hFile;
  39. }; // ccsv
  40. #endif //_CCSV_INC_