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


C++ IODevice::write方法代码示例

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


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

示例1: save

void ZipFileHeader::save(IODevice &output)
{
	std::string str_filename;
	std::string str_comment;
	if (general_purpose_bit_flag & ZIP_USE_UTF8)
	{
		str_filename = StringHelp::text_to_utf8(filename);
		str_comment = StringHelp::text_to_utf8(file_comment);
	}
	else
	{
		str_filename = StringHelp::text_to_cp437(filename);
		str_comment = StringHelp::text_to_cp437(file_comment);
	}

	file_name_length = str_filename.length();
	file_comment_length = str_comment.length();

	output.write_int32(signature);
	output.write_int16(version_made_by);
	output.write_int16(version_needed_to_extract);
	output.write_int16(general_purpose_bit_flag);
	output.write_int16(compression_method);
	output.write_int16(last_mod_file_time);
	output.write_int16(last_mod_file_date);
	output.write_uint32(crc32);
	output.write_int32(compressed_size);
	output.write_int32(uncompressed_size);
	output.write_int16(file_name_length);
	output.write_int16(extra_field_length);
	output.write_int16(file_comment_length);
	output.write_int16(disk_number_start);
	output.write_int16(internal_file_attributes);
	output.write_int32(external_file_attributes);
	output.write_int32(relative_offset_of_local_header);
	output.write(str_filename.data(), file_name_length);
	output.write(extra_field.get_data(), extra_field_length);
	output.write(file_comment.data(), file_comment_length);
}
开发者ID:ARMCoderCHS,项目名称:ClanLib,代码行数:39,代码来源:zip_file_header.cpp

示例2:

	void Zip64EndOfCentralDirectoryRecord::save(IODevice &output)
	{
		output.write_int32(signature);
		output.write_int64(size_of_record);
		output.write_int16(version_made_by);
		output.write_int16(version_needed_to_extract);
		output.write_int32(number_of_this_disk);
		output.write_int32(number_of_disk_with_central_directory_start);
		output.write_int64(number_of_entries_on_this_disk);
		output.write_int64(number_of_entries_in_central_directory);
		output.write_int64(size_of_central_directory);
		output.write_int64(offset_to_start_of_central_directory);
		output.write(extensible_data_sector.data(), extensible_data_sector.size());
	}
开发者ID:keigen-shu,项目名称:ClanLib,代码行数:14,代码来源:zip_64_end_of_central_directory_record.cpp

示例3: sizeof

Error Commander::
writeCommand (const Command & cmd) {
	IODevice *dd = d->device;
	Error rc;
	assert(dd != 0);


	std::stringstream buf;
	buf << cmd.getName() << '\0';

	std::vector<String> args = cmd.getArguments();
	for (unsigned i=0;i<args.size();i++) {
		buf << args[i] << '\0';
	}

	String data = buf.str();
	CommandHeader hdr;
	// Write header
	{
		::memset (&hdr,0,sizeof(hdr));
		hdr.length = data.size();
	}

	// Write data
	{
		rc = dd->write((char *)&hdr, sizeof(hdr));
		if ( !rc.isSuccess()) {
			return rc;
		}
		rc = dd->write(data.c_str(), data.size());
		if ( !rc.isSuccess() ) {
			return rc;
		}
	}

	return rc;
}
开发者ID:simophin,项目名称:remotevision,代码行数:37,代码来源:Commander.cpp


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