当前位置: 首页>>代码示例>>C++>>正文


C++ fstream::gcount方法代码示例

本文整理汇总了C++中std::fstream::gcount方法的典型用法代码示例。如果您正苦于以下问题:C++ fstream::gcount方法的具体用法?C++ fstream::gcount怎么用?C++ fstream::gcount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在std::fstream的用法示例。


在下文中一共展示了fstream::gcount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: encryptData

bool XorEncryptor::encryptData(std::fstream &original, std::fstream &result)
{
	if (!original.is_open() || !result.is_open())
	{
		return false;
	}

	original.seekg(0, std::ios::beg);
	result.seekp(0, std::ios::beg);

	char c = 0;
	unsigned i = 0;
	while (original.good())
	{
		original.read(&c, 1);
		c ^= password[i];
		if(original.gcount() > 0)
		{
			result.write(&c, 1);
		}

		if (++i == passSize)
		{
			i = 0;
		}
	}

	original.seekg(0, std::ios::beg);
	result.seekg(0, std::ios::beg);
	result.flush();

	return true;
}
开发者ID:Yashchuk,项目名称:GL-Base-camp,代码行数:33,代码来源:XorEncryptor.cpp

示例2: leerLinea

void Agente::leerLinea(std::fstream& archivo, std::string& linea) {
	linea.clear();

	char buffer[T_BUFFER];

	bool seguirLeyendo = true;
	do {
		archivo.getline(buffer, T_BUFFER, '\n');
		linea.append(buffer, archivo.gcount());

		seguirLeyendo = (archivo.gcount() == T_BUFFER);

		if (archivo.bad())
			archivo.clear();

	} while (seguirLeyendo);
}
开发者ID:SebastianBogado,项目名称:fiuba-7542-tp-final,代码行数:17,代码来源:Agente.cpp

示例3:

bool
StandardFileProvider::read( void* buffer, Size size, Size& nin, Size maxChunkSize )
{
    _fstream.read( (char*)buffer, size );
    if( _fstream.fail() )
        return true;
    nin = _fstream.gcount();
    return false;
}
开发者ID:yjaelex,项目名称:source,代码行数:9,代码来源:osFile_posix.cpp

示例4: read

	/**
	 * Read data from the stream. Subclasses must implement this
	 * method; all other read methods are implemented using it.
	 *
	 * @note The semantics of any implementation of this method are
	 * supposed to match those of ISO C fread(), in particular where
	 * it concerns setting error and end of file/stream flags.
	 *
	 * @param dataPtr	pointer to a buffer into which the data is read
	 * @param dataSize	number of bytes to be read
	 * @return the number of bytes which were actually read.
	 */
	virtual uint32 read(void *dataPtr, uint32 dataSize) {
		_stream->read((char*)dataPtr, dataSize);
		return _stream->gcount();
	}
开发者ID:somaen,项目名称:Wintermute-git,代码行数:16,代码来源:myfilestream.cpp


注:本文中的std::fstream::gcount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。