|
|
|
|
|
// File64.h: interface for the CFile64 class.
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>:
|
|
|
|
|
|
// <09><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
//
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д: 2008-11-09
|
|
|
|
|
|
//
|
|
|
|
|
|
//
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
#include <io.h>
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>һ<EFBFBD><D2BB>64λ<34><CEBB><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊָ<CEAA><D6B8>radix(10<31><30><EFBFBD>ơ<EFBFBD>16<31><36><EFBFBD>ơ<EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD>)<29><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
|
|
|
void Integer64ToString( __int64 value, char *string, int radix );
|
|
|
|
|
|
__int64 StringToInteger64( const char *string ); //<2F><>һ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ת<EFBFBD><D7AA>Ϊ64λ<34><CEBB><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(AFX_FILE64_H__48BF1FE7_1799_4B95_A4AE_A9BDD4D5C2E6__INCLUDED_)
|
|
|
|
|
|
#define AFX_FILE64_H__48BF1FE7_1799_4B95_A4AE_A9BDD4D5C2E6__INCLUDED_
|
|
|
|
|
|
|
|
|
|
|
|
#if _MSC_VER > 1000
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
#endif // _MSC_VER > 1000
|
|
|
|
|
|
/*
|
|
|
|
|
|
class CFile64 : public CFile
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
CFile64();
|
|
|
|
|
|
virtual ~CFile64();
|
|
|
|
|
|
|
|
|
|
|
|
virtual BOOL Open(LPCTSTR lpszFileName); //<2F><>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
BOOL OpenWrite(LPCTSTR lpszFileName,BOOL bTruncate=FALSE); //<2F><>д<EFBFBD><D0B4>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
BOOL OpenAppend(LPCTSTR lpszFileName); //<2F><><EFBFBD><D7B7>д<EFBFBD><D0B4>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
virtual BOOL IsOpen(void);
|
|
|
|
|
|
};*/
|
|
|
|
|
|
|
|
|
|
|
|
namespace NFile64
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
class CFile64
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
CFile64(LPCTSTR lpszFileName, int oflag=_O_BINARY|_O_RDONLY, int pmode=_S_IREAD);
|
|
|
|
|
|
CFile64();
|
|
|
|
|
|
virtual ~CFile64();
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
virtual BOOL Open(LPCTSTR lpszFileName); //<2F><>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
virtual UINT Read( void *lpBuf, UINT count); //<2F><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>β<EFBFBD><CEB2><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-1
|
|
|
|
|
|
virtual void Write(const void *lpBuf, UINT count);
|
|
|
|
|
|
virtual BOOL IsOpen(void);
|
|
|
|
|
|
virtual BOOL IsEof();
|
|
|
|
|
|
virtual void Close();
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ͷ SEEK_SET, <20><>β SEEK_END, <20><>ǰ SEEK_CUR;
|
|
|
|
|
|
virtual __int64 Seek(__int64 offset, int origin); //ʧ<>ܷ<EFBFBD><DCB7><EFBFBD>-1
|
|
|
|
|
|
|
|
|
|
|
|
__int64 SeekToEnd();
|
|
|
|
|
|
void SeekToBegin();
|
|
|
|
|
|
void Flush();
|
|
|
|
|
|
|
|
|
|
|
|
__int64 GetStat( struct _stati64 *buffer ); //<2F>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʧ<EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>-1
|
|
|
|
|
|
__int64 GetLength(); //<2F>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ȣ<EFBFBD>ʧ<EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>-1
|
|
|
|
|
|
__int64 GetPosition(); //ʧ<>ܷ<EFBFBD><DCB7><EFBFBD>-1<><31><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>64λѰַ<D1B0><D6B7><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>ȷ<EFBFBD><C8B7>
|
|
|
|
|
|
int GetHandle(void); //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>TRUE<55><45><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FALSE
|
|
|
|
|
|
BOOL Open( LPCTSTR lpszFileName, int oflag, int pmode );
|
|
|
|
|
|
BOOL Open( LPCTSTR lpszFileName, int oflag );
|
|
|
|
|
|
//<2F>ԡ<EFBFBD>_O_BINARY|_O_CREAT|_O_WRONLY|_O_TRUNC, _S_IWRITE<54><45><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
BOOL OpenWrite(LPCTSTR lpszFileName,BOOL bTruncate=FALSE);
|
|
|
|
|
|
BOOL OpenAppend(LPCTSTR lpszFileName);//<2F><><EFBFBD><D7B7>д<EFBFBD><D0B4>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
int m_hFile;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
using namespace NFile64;
|
|
|
|
|
|
|
|
|
|
|
|
inline BOOL CFile64::IsOpen(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_hFile==-1) return 0;
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline int CFile64::GetHandle(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_hFile;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !defined(AFX_FILE64_H__48BF1FE7_1799_4B95_A4AE_A9BDD4D5C2E6__INCLUDED_)
|