本文整理汇总了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);
}
示例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());
}
示例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;
}