本文整理汇总了C++中ostream::seekp方法的典型用法代码示例。如果您正苦于以下问题:C++ ostream::seekp方法的具体用法?C++ ostream::seekp怎么用?C++ ostream::seekp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ostream
的用法示例。
在下文中一共展示了ostream::seekp方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteSize
void WriteSize(ostream& out)
{
unsigned filesize = out.tellp();
unsigned size = filesize - 8;
out.seekp(4, ios_base::beg);
out.write((char*)&size, 4);
unsigned data_size = filesize - 44;
out.seekp(40, ios_base::beg);
out.write((char*)&data_size, 4);
}
示例2: WriteHeader
int IOBuffer::WriteHeader(ostream & stream) const{
stream.seekp(0, ios::beg);
stream.write(headerStr, headerSize);
if(!stream.good())
return -1;
return headerSize;
}
示例3: assert
void DSA1Intro::write(ostream& strm) {
header_size = 20;
count = entries.size(); // WRONG! Come back later to change it
u16 truecount = 0;
write16(strm, count);
for (u8 i=0; i<0x20-2; i++) write8(strm, 0);
u32 offset = 0;
for (u32 i=0; i<count; i++) {
// Nach Duplikaten suchen und diese markieren
u32 j = 0;
for ( ; j<i; j++) {
if (entries[i]->name == entries[j]->name) break;
}
if (j == i) { // Kein Duplikat gefunden
entries[i]->offset = offset;
entries[i]->write(strm);
offset += entries[i]->size;
truecount++;
} else { // Duplikat gefunden
entries[i]->offset = entries[j]->offset;
assert(entries[i]->size == entries[j]->size);
entries[i]->write(strm);
}
}
for (u32 i=count; i < 139 ; i++) {
for (u32 j=0; j < 0x20; j++) write8(strm, 0x00);
}
strm.seekp(0);
write16(strm, truecount-1); // DUMMY nicht mitzählen
}
示例4: NumRecords
void
EDFOutputFormat::StopRun( ostream& os )
{
const int NumRecFieldPos = 236;
if( os.seekp( NumRecFieldPos ) )
PutField< Str<8> >( os, NumRecords() );
EDFOutputBase::StopRun( os );
}
示例5: DWrite
int IOBuffer::DWrite(ostream & stream, int recref) const
// write specified record
{
stream.seekp(recref, ios::beg);
if(stream.tellp() != recref)
return -1;
return Write(stream);
}
示例6:
void
JSeekp
(
ostream& stream,
long position
)
{
stream.seekp((streamoff) position);
}
示例7: write_object
void write_object(ostream &out, ObjectBuilder &obj)
{
ResourceTableHeader tbl_header;
write_header(out, obj.header);
write_resource_header(out, tbl_header);
tbl_header = write_resource_table(out, obj.rs);
// and rewrite the header w/ correct offsets & sizes
out.seekp(0);
write_header(out, obj.header);
write_resource_header(out, tbl_header);
}
示例8: StreamSelectionWiresOut
void Fl_Canvas::StreamSelectionWiresOut(ostream &s)
{
int total_wires = 0, curpos=0;
curpos = s.tellp();
s<<-1<<endl;
if (m_WireVec.size()>0)
for(vector<CanvasWire>::iterator i=m_WireVec.begin();
i!=m_WireVec.end(); i++)
{
std::vector<int>::iterator output = std::find( m_Selection.m_DeviceIds.begin(), m_Selection.m_DeviceIds.end(), i->OutputID );
std::vector<int>::iterator input = std::find( m_Selection.m_DeviceIds.begin(), m_Selection.m_DeviceIds.end(), i->InputID );
if ((input != m_Selection.m_DeviceIds.end()) && (output != m_Selection.m_DeviceIds.end()))
{
s<<i->OutputID<<" ";
s<<0<<" ";
s<<i->OutputPort<<" ";
s<<i->OutputTerminal<<" ";
s<<i->InputID<<" ";
s<<0<<" ";
s<<i->InputPort<<" ";
s<<i->InputTerminal<<endl;
total_wires += 1;
}
}
if (total_wires >= 1)
{
s.seekp(curpos, ios::beg);
s<<total_wires<<endl;
s.seekp(0, ios::end);
}
}
示例9: SerializeSummary
void SerializeSummary(FPackageFileSummary Summary, ostream& stream)
{
/// reset compression flags
Summary.CompressionFlags = 0;
Summary.PackageFlags ^= (uint32_t)UPackageFlags::Compressed;
Summary.NumCompressedChunks = 0;
/// serialize summary
stream.seekp(0);
stream.write(reinterpret_cast<char*>(&Summary.Signature), 4);
int32_t tmpVer = Summary.Version + (Summary.LicenseeVersion << 16);
stream.write(reinterpret_cast<char*>(&tmpVer), 4);
stream.write(reinterpret_cast<char*>(&Summary.HeaderSize), 4);
stream.write(reinterpret_cast<char*>(&Summary.FolderNameLength), 4);
if (Summary.FolderNameLength > 0)
{
stream.write(Summary.FolderName.c_str(), Summary.FolderNameLength);
}
stream.write(reinterpret_cast<char*>(&Summary.PackageFlags), 4);
stream.write(reinterpret_cast<char*>(&Summary.NameCount), 4);
stream.write(reinterpret_cast<char*>(&Summary.NameOffset), 4);
stream.write(reinterpret_cast<char*>(&Summary.ExportCount), 4);
stream.write(reinterpret_cast<char*>(&Summary.ExportOffset), 4);
stream.write(reinterpret_cast<char*>(&Summary.ImportCount), 4);
stream.write(reinterpret_cast<char*>(&Summary.ImportOffset), 4);
stream.write(reinterpret_cast<char*>(&Summary.DependsOffset), 4);
stream.write(reinterpret_cast<char*>(&Summary.SerialOffset), 4);
stream.write(reinterpret_cast<char*>(&Summary.Unknown2), 4);
stream.write(reinterpret_cast<char*>(&Summary.Unknown3), 4);
stream.write(reinterpret_cast<char*>(&Summary.Unknown4), 4);
stream.write(reinterpret_cast<char*>(&Summary.GUID), sizeof(Summary.GUID));
stream.write(reinterpret_cast<char*>(&Summary.GenerationsCount), 4);
for (unsigned i = 0; i < Summary.GenerationsCount; ++i)
{
stream.write(reinterpret_cast<char*>(&Summary.Generations[i].ExportCount), 4);
stream.write(reinterpret_cast<char*>(&Summary.Generations[i].NameCount), 4);
stream.write(reinterpret_cast<char*>(&Summary.Generations[i].NetObjectCount), 4);
}
stream.write(reinterpret_cast<char*>(&Summary.EngineVersion), 4);
stream.write(reinterpret_cast<char*>(&Summary.CookerVersion), 4);
stream.write(reinterpret_cast<char*>(&Summary.CompressionFlags), 4);
stream.write(reinterpret_cast<char*>(&Summary.NumCompressedChunks), 4);
if (Summary.UnknownDataChunk.size() > 0)
{
stream.write(Summary.UnknownDataChunk.data(), Summary.UnknownDataChunk.size());
}
}
示例10: createPrimary
void createPrimary(istream& read, ostream& primary){
int number,byte = 0;
map<int,int> mymap;
PrimaryIndex p;
ClientData client;
read.clear();
read.seekg(0);
primary.seekp(0);
if(read.eof())return;
read >> client;
while(!read.eof()){
if(number = client.getAccountNumber()){
mymap[number] = byte;
byte = read.tellg();
}
read >> client;
}
for(map<int,int>::iterator it = mymap.begin(); it != mymap.end(); it++){
p.AccountNumber = it->first;
p.Byte = it->second;
primary.write(reinterpret_cast<char*>(&p), sizeof(PrimaryIndex));
}
}
示例11: pagesizealign
void MemoryMap::pagesizealign(ostream &out)
{
size_t at = out.tellp();
size_t offs = at % pagesize;
if(offs) { out.seekp(pagesize - offs, ios::cur); }
}
示例12: RemoveLastSymbol
void RemoveLastSymbol(ostream& stream)
{
stream.seekp(static_cast<int>(stream.tellp()) - 1);
}
示例13: write
//.........这里部分代码省略.........
const char LL_DESC [CORNER_DESC_SIZE + 1]
= " LL ";
const char BANDS_PRESENT_DESC [BANDS_PRESENT_DESC_SIZE + 1]
= " BANDS PRESENT =";
const char BLOCKING_FACTOR_DESC [BLOCKING_FACTOR_DESC_SIZE + 1]
= " BLOCKING FACTOR =";
const char RECORD_LENGTH_DESC [RECORD_LENGTH_DESC_SIZE + 1]
= " RECORD LENGTH =";
const char SUN_ELEVATION_DESC [SUN_ELEVATION_DESC_SIZE + 1]
= " SUN ELEVATION =";
const char SUN_AZIMUTH_DESC [SUN_AZIMUTH_DESC_SIZE + 1]
= " SUN AZIMUTH =";
const char CENTER_DESC [CENTER_DESC_SIZE + 1]
= " CENTER ";
const char OFFSET_DESC [OFFSET_DESC_SIZE + 1]
= " OFFSET=";
const char REV_DESC [REV_DESC_SIZE + 1]
= " REV";
const char SPACE[] = " ";
//***
// Start at beginning of the stream.
//***
os.seekp(0, ios::beg);
os << setiosflags(ios::fixed) // Disable scientific mode.
<< setiosflags(ios::left)
<< PRODUCT_ID_DESC
<< setw(PRODUCT_ORDER_NUMBER_SIZE)
<< theProductOrderNumber
<< WRS_DESC
<< setw(PATH_ROW_NUMBER_SIZE)
<< thePathRowNumber
<< DATE_DESC
<< setw(DATE_SIZE)
<< theAcquisitionDate
<< SATELLITE_NUMBER_DESC
<< setw(SAT_NUMBER_SIZE)
<< theSatNumber
<< INSTRUMENT_TYPE_DESC
<< setw(INSTRUMENT_TYPE_SIZE)
<< theInstrumentType
<< PRODUCT_TYPE_DESC
<< setw(PRODUCT_TYPE_SIZE)
<< theProductType
<< PRODUCT_SIZE_DESC
<< setw(PRODUCT_SIZE_SIZE)
<< theProductSize
<< setw(MAP_SHEET_SIZE)
示例14: save
void Model::save(ostream & out) {
// write a signature
char chunk[16] = {'l','g','d','p', 'j', 0};
out.write(chunk, 16);
unsigned int tmp;
int off = out.tellp();
unsigned basic_offset = 0;
unsigned postag_offset = 0;
unsigned deprels_offset = 0;
unsigned feature_offset = 0;
unsigned parameter_offset = 0;
// write pseduo position
write_uint(out, 0); // basic offset
write_uint(out, 0); // postag offset
write_uint(out, 0); // deprels offset
write_uint(out, 0); // features offset
write_uint(out, 0); // parameters offset
// model and feature information
// labeled model
basic_offset = out.tellp();
tmp = model_opt.labeled;
write_uint(out, tmp);
// decode order
strncpy(chunk, model_opt.decoder_name.c_str(), 16);
out.write(chunk, 16);
// use dependency
tmp = feat_opt.use_dependency;
write_uint(out, tmp);
// use dependency unigram
tmp = feat_opt.use_dependency_unigram;
write_uint(out, tmp);
// use dependency bigram
tmp = feat_opt.use_dependency_bigram;
write_uint(out, tmp);
// use dependency surrounding
tmp = feat_opt.use_dependency_surrounding;
write_uint(out, tmp);
// use dependency between
tmp = feat_opt.use_dependency_between;
write_uint(out, tmp);
// use sibling
tmp = feat_opt.use_sibling;
write_uint(out, tmp);
// use sibling basic
tmp = feat_opt.use_sibling_basic;
write_uint(out, tmp);
// use sibling linear
tmp = feat_opt.use_sibling_linear;
write_uint(out, tmp);
// use grand
tmp = feat_opt.use_grand;
write_uint(out, tmp);
// use grand basic
tmp = feat_opt.use_grand_basic;
write_uint(out, tmp);
// use grand linear
tmp = feat_opt.use_grand_linear;
write_uint(out, tmp);
// save postag lexicon
postag_offset = out.tellp();
postags.dump(out);
// save dependency relation lexicon
deprels_offset = out.tellp();
deprels.dump(out);
feature_offset = out.tellp();
space.save(out);
parameter_offset = out.tellp();
param.dump(out);
out.seekp(off);
write_uint(out, basic_offset);
write_uint(out, postag_offset);
write_uint(out, deprels_offset);
write_uint(out, feature_offset);
write_uint(out, parameter_offset);
// out.seekp(0, std::ios::end);
}