本文整理汇总了C++中stringstream::tellg方法的典型用法代码示例。如果您正苦于以下问题:C++ stringstream::tellg方法的具体用法?C++ stringstream::tellg怎么用?C++ stringstream::tellg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stringstream
的用法示例。
在下文中一共展示了stringstream::tellg方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseError
bool parseError(stringstream& ss, string errMessage, int offset = 0) {
ss.clear();
int colNo = (int) ss.tellg();
if (colNo <= 0) colNo = 1;
colNo += offset;
cerr
// << ss.str() << endl
<< setw(colNo) << right << "^" << endl
<< "Parse error: col #" << colNo << ", " << errMessage << endl;
return false;
}
示例2: Parse
void CIF::Parse(stringstream &in)
{
bool vv=false;//very verbose ?
char lastc=' ';
string block="";// Current block data
while(!in.eof())
{
stringstream mess;
mess<<"CIF: Parsing:"<<in.tellg();
(*fpObjCrystInformUser)(mess.str());
while(!isgraph(in.peek()) && !in.eof()) in.get(lastc);
if(in.eof()) break;
if(vv) cout<<endl;
if(in.peek()=='#')
{//Comment
string tmp;
getline(in,tmp);
if(block=="") mvComment.push_back(tmp);
else mvData[block].mvComment.push_back(tmp);
lastc='\r';
if(vv)cout<<"Comment:"<<tmp<<endl;
continue;
}
if(in.peek()=='_')
{//Tag
string tag,value;
in>>tag;
// Convert all dots to underscores to cover much of DDL2 with this DDL1 parser.
for (string::size_type pos = tag.find('.'); pos != string::npos; pos = tag.find('.', ++ pos))
tag.replace(pos, 1, 1, '_');
value=CIFReadValue(in,lastc);
if(value==string("?")) continue;//useless
mvData[block].mvItem[ci_string(tag.c_str())]=value;
if(vv)cout<<"New Tag:"<<tag<<" ("<<value.size()<<"):"<<value<<endl;
continue;
}
if((in.peek()=='d') || (in.peek()=='D'))
{// Data
string tmp;
in>>tmp;
block=tmp.substr(5);
if(vv) cout<<endl<<endl<<"NEW BLOCK DATA: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ->"<<block<<endl<<endl<<endl;
mvData[block]=CIFData();
continue;
}
示例3: seco
void seco(void){
cout << "position: "<<inFile.tellg()<<endl;
cout << inFile.str()<<endl;
}
示例4: main
int main(int argc, char* argv[]) {
prim();
cout << "MinFile.str: "<<inFile.str();
cout << "Mposition: "<<inFile.tellg()<<endl;
seco();
}
示例5: prim
void prim(void){
// outFile << "output this" << endl;
inFile << "output this" << endl;
cout << "inFile.str: "<<inFile.str();
cout << "position: "<<inFile.tellg()<<endl;
}