Leaked source code of windows server 2003
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.

39 lines
983 B

  1. #ifndef _CCSV
  2. #define _CCSV
  3. #include <windows.h>
  4. #ifdef WIN16
  5. #include <win16def.h>
  6. #endif
  7. #define CCSVFILE_BUFFER_SIZE 2*512
  8. // simple file i/o for phone books
  9. class CCSVFile
  10. {
  11. public:
  12. void far * operator new( size_t cb ) { return GlobalAlloc(GPTR,cb); };
  13. void operator delete( void far * p ) {GlobalFree(p); };
  14. CCSVFile();
  15. ~CCSVFile();
  16. BOOLEAN Open(LPCTSTR pszFileName);
  17. BOOLEAN ReadToken(LPTSTR pszDest, DWORD cbMax); // reads up to comma or newline, returns fFalse on EOF
  18. void Close(void);
  19. inline int ILastRead(void)
  20. {
  21. return m_iLastRead;
  22. }
  23. private:
  24. BOOL FReadInBuffer(void);
  25. inline int ChNext(void);
  26. CHAR m_rgchBuf[CCSVFILE_BUFFER_SIZE]; //buffer
  27. LPSTR m_pchBuf; //pointer to the next item in the buffer to read
  28. LPSTR m_pchLast; //pointer to the last item in the buffer
  29. int m_iLastRead; //the character last read.
  30. DWORD m_cchAvail;
  31. HANDLE m_hFile;
  32. }; // ccsv
  33. #endif //_CCSV