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.

36 lines
1.1 KiB

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