对于下面附加的 tcptrace 输出(这是从站点http://tcptrace.org/manual/index.html在 RTT stats 下获取的)
1 arg remaining, starting with 'indica.dmp.gz'
Ostermann's tcptrace -- version 6.4.5 -- Fri Jun 13, 2003
153 packets seen, 153 TCP packets traced
elapsed wallclock time: 0:00:00.128422, 1191 pkts/sec analyzed
trace file elapsed time: 0:00:19.092645
TCP connection info:
1 TCP connection traced:
TCP connection 1:
host a: 192.168.0.70:32791
host b: webco.ent.ohiou.edu:23
complete conn: yes
first packet: Thu Aug 29 18:54:54.782937 2002
last packet: Thu Aug 29 18:55:13.875583 2002
elapsed time: 0:00:19.092645
total …Run Code Online (Sandbox Code Playgroud) 所以我试图利用istringstream来解析文本文件.我们的想法是按空间分解每一行,并根据子串做事.代码工作正常,除了两件事,它重复计算每一行的最后一个子字符串,当它完成读取文件时它会出错.我之前没有使用过sstream,所以任何见解都会有所帮助.
file.getline(str,80);
while(!file.eof())
{
cout<<str<<endl;
istringstream iss(str);
while (iss)
{
iss >> sstr;
cout << "Substring: " <<sstr << endl;
}
file.getline(str,80);
}
Run Code Online (Sandbox Code Playgroud)