inputstream.cpp

来自「一个symbian 冒险游戏代码」· C++ 代码 · 共 39 行

CPP
39
字号
#include <io/InputStream.h>
#include <assert.h>
#include <stdint.h>
#include <config.h>


namespace io
{


int InputStream::skip( int n )
{
	assert( n >= 0 );

	const int buffSize = 256;
	uint8_t buff[buffSize];

	int bytesSkipped = 0;
	while ( bytesSkipped < n )
	{
		int bytes = n - bytesSkipped;
		if ( bytes > buffSize )
			bytes = buffSize;

		bytes = read( buff, bytes );
		bytesSkipped += bytes;

		if ( 0 == bytes )
			break;
	}

	return bytesSkipped;
}


} // io


⌨️ 快捷键说明

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