home *** CD-ROM | disk | FTP | other *** search
/ PC Administrator / spravce.iso / RunModule / src / Stdfile.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-08-31  |  2.9 KB  |  73 lines

  1. // StdFile.h: interface for the CStdFile class.
  2. //
  3. /*
  4. Copyright 2001 Anish Mistry. All rights reserved.
  5.  
  6. Redistribution and use in source and binary forms, with or without modification,
  7. are permitted provided that the following conditions are met:
  8.  
  9.    1. Redistributions of source code must retain the above copyright notice, 
  10.    this list of conditions and the following disclaimer.
  11.    2. Redistributions in binary form must reproduce the above copyright notice,
  12.    this list of conditions and the following disclaimer in the documentation 
  13.    and/or other materials provided with the distribution.
  14.  
  15. THIS SOFTWARE IS PROVIDED BY ANISH MISTRY ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  16. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
  17. AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 
  18. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  19. OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  20. GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  21. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  22. TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24.  
  25. The views and conclusions contained in the software and documentation are those
  26. of the authors and should not be interpreted as representing official policies,
  27. either expressed or implied, of Anish Mistry or AM Productions.
  28.  
  29. * Variation of the FreeBSD License. http://www.freebsd.org/copyright/freebsd-license.html
  30. */
  31. //////////////////////////////////////////////////////////////////////
  32.  
  33. #if !defined(AFX_STDFILE_H__44214218_8F1A_4792_8D4D_8147F50E168D__INCLUDED_)
  34. #define AFX_STDFILE_H__44214218_8F1A_4792_8D4D_8147F50E168D__INCLUDED_
  35.  
  36. #if _MSC_VER > 1000
  37. #pragma once
  38. #endif // _MSC_VER > 1000
  39.  
  40. class CStdFile  
  41. {
  42. public:
  43.     unsigned long int GetPos();
  44.     DWORD Seek(DWORD pos,DWORD start);
  45.     DWORD GetLength();
  46.     DWORD Write(const char *buffer, DWORD bytesToWrite);
  47.     DWORD Read(char *buffer, DWORD bytesToRead);
  48.     const char * GetFilePath();
  49.     const char * GetFileName();
  50.     static bool Rename(const char *source,const char *dest);
  51.     CStdFile();
  52.     virtual ~CStdFile();
  53.     static bool Delete(const char *fileName);
  54.     inline static int GetStringLength(register const char *str)
  55.     {
  56.         for(register unsigned int i = 0;str[i] != NULL;i++);
  57.         return i;
  58.     }
  59.     bool Open(const char *filename,DWORD accessFlags, DWORD shareAccess, DWORD creationAttributes);
  60.     DWORD WriteLine(const char *);
  61.     DWORD ReadLine(char *bufferOut);
  62.     bool Close();
  63.  
  64. protected:
  65.     void GetName(const char *fileString,char *fileBufferOut);
  66.     DWORD currentFilePos;
  67.     char path[MAX_PATH];
  68.     char name[MAX_PATH];
  69.     HANDLE fileHandle;
  70. };
  71.  
  72. #endif // !defined(AFX_STDFILE_H__44214218_8F1A_4792_8D4D_8147F50E168D__INCLUDED_)
  73.