0
我一直想要在找到[1],[2] ... [n]之后提取一行文本。但似乎我无法将思路存储到以[1]开始的字符中。来自文本文件的C++滤镜内容
void ExtractWebContent::filterContent(){
char str [10];
ifstream reading;
reading.open("file_Currency.txt");
while (!reading.eof()){
reading.get(str,10,'[1]');
cout << str << endl;
}
cout << str;
reading.close();
}
这是我想从提取的文件..
CAPTION: Currencies Name Price Change % Chg [80]USD/SGD 1.2606 -0.00 -0.13% USD/SGD [81]USDSGD=X [82]EUR/SGD 1.5242 0.00 +0.11% EUR/SGD [83]EURSGD=X
我使用Linux,C++编程。这是为了过滤从HTML文本文件中获得的数字。
任何帮助将非常感激。谢谢!
感谢您的纠正。但我仍然不确定如何解决。我现在在做的是getline并希望消除不需要的字符。 void ExtractWebContent :: filterContent(){ string str; ifstream阅读; ifstream阅读; reading.open(“file_Currency.txt”); (!reading.eof()){ getline(reading,str,''); cout << str << endl; } cout << str; reading.close(); } – 2012-07-25 08:26:02