memoryfilestream.h

来自「自己写的一个IO库」· C头文件 代码 · 共 65 行

H
65
字号

/*------------------------------------------------------------------------------

  @filename : MemoryFileStream.h


/********************************************************************************


*/


#ifndef _MEMORYFILE_H_
#define _MEMORYFILE_H_

#include <cstdio>
#include <cstdlib>
#include <memory>

#include "IFileStream.h"

namespace IMS_IO
{
	class CMemoryFileStream : public IFileStream  
	{
		struct SHead
		{
			SHead()
			{
				this->nLength = 0;
				this->nCurPos = 0;
				this->pContent = 0;
				this->bClose   = false;
				this->bClose   = false;
			}

			long nLength;
			long nCurPos;   //当前位置
			bool bOPen  ;   //是否打开了
			bool bClose ;   //是否关闭了
			unsigned char *pContent;
		};

	public:
		CMemoryFileStream();
		virtual ~CMemoryFileStream();
	
	public:
		bool open(const char *pHandler,int length,char *pFlag);
	
		int seek(long offset,int origin);

		int read(void *pBuffer,int size,int count);

		bool close();

		long length();

		long getPos();
	public :
		SHead  m_memFileHandler ;
	};
}

#endif 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?