本文整理汇总了C++中std::ostringstream::seekp方法的典型用法代码示例。如果您正苦于以下问题:C++ ostringstream::seekp方法的具体用法?C++ ostringstream::seekp怎么用?C++ ostringstream::seekp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::ostringstream
的用法示例。
在下文中一共展示了ostringstream::seekp方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: seek
bool seek(size_t v, int origin)
{
if (origin == SEEK_CUR)
stream.seekp(v, std::ios_base::cur);
else if (origin == SEEK_END)
stream.seekp(v, std::ios_base::end);
else
stream.seekp(v, std::ios_base::beg);
return !stream.fail();
}
示例2: sendBuffer
Variant ClientBase::sendBuffer(char type, RequestID requestID, std::ostringstream &stream)
{
unsigned int size = (unsigned int)stream.tellp();
size -= sizeof(size);
stream.seekp(0);
stream.write((const char*)&size, sizeof(size));
RequestData rd;
rd.type = MessageType(type);
rd.id = requestID;
rd.data = stream.str();
if(asyncMode())
{
rd.writeCompletePtr.reset(new FutureResult);
bool empty = m_messageQueue.empty();
m_messageQueue.push(rd);
if(empty)
{
writeData(m_messageQueue.front().data);
}
return rd.writeCompletePtr;
}
else
{
writeData(rd.data);
}
return Variant();
}
示例3: expand
std::string expand(Range const& key)
{
thread_local std::ostringstream oss;
oss.str().clear();
oss.clear();
oss.seekp(0);
oss << " (subst_for_" << key.to_string() << ':' << (rand()%42) << ") ";
return oss.str();
}
示例4: Journal
ostream & Journal(entier level)
{
if (level <= journal_level) {
cerr << "[" << level << "] ";
return cerr;
} else {
junk_journal.seekp(0);
return junk_journal;
}
}
示例5: to_binary
std::string to_binary(std::ostringstream &out, const T &t) {
out.clear();
out.seekp(0);
bf::fold(t, 0, app_item(out));
// because out.str() gives us the contents of the string buffer,
// not the contents written since clear() was called, we need to
// chop off any remaining garbage at the end.
std::string rv = out.str();
rv.resize(out.tellp());
return rv;
}
示例6: write_playlist_segment
u64 write_playlist_segment(u64 seg_num, u64 timeref){
tmp = vidListStream.str();
vidListStream.seekp(0);
vidListStream << "\n\t\t{ \n\t\t\"Open_segment_time\":" << "\"" << timeref << "\",";
vidListStream << "\n\t\t\"Video_Segment\": \"seg_" << seg_num << "_gpac.m4s\",\n\t\t\"Skel_Segments\":";
// vidListStream << "[" << skelListStream.str() << "],\n\t\t";
// vidListStream << "\"Slides\": [" << imListStream.str() << "]\n";
if (seg_num == 1){
vidListStream << "\t\t}\n";
}
else{
vidListStream << "\t\t},\n";
}
vidListStream << tmp;
finalStream << "{\"Playlist\":\n\t[" << vidListStream.str();
vidPlaylist.open("x64/Debug/out/playlist.json");
vidPlaylist << finalStream.str();
vidPlaylist.close();
finalStream.str("");
// imListStream.str("");
// skelListStream.str("");
playlistStream << "http://" << ipAddr << ":8080/x64/Debug/out/seg_" << seg_num << "_gpac.m4s\n";
playlistFile.open("x64/Debug/out/playlist.m3u8");
if (playlistFile.is_open()){
playlistFile << playlistStream.str();
}
playlistFile.close();
seg_num++;
return seg_num;
}
示例7: cleanup
void cleanup() {
featureVector.clear();
os.clear(); os.seekp(0); // reset string stream
os.str("");
}
示例8: close
void close()
{
stream.seekp(0, std::ios_base::end);
std::string v = stream.str();
SteamRemoteStorage()->FileWrite(filename.c_str(), &v[0], v.size());
}