> Actually you have two sets of delimiters, end of line and ~. So you
need two
nested loops, the outer reading lines and the inner reading ~
delimited text.
If all what needs to be done is replacing the tilde characters by tab
characters, I would just do that:
| #include <fstream>
| #include <algorithm>
| #include <iterator>
| int main() {
| std::ifstream in("in.file");
| std::ofstream out("out.file");
| std::replace_copy(std::istreambuf_iterator<char>(i n),
| std::istreambuf_iterator<char>(),
| std::ostreambuf_iterator<char>(out),
| '~', '\t');
| }
If speed does matter, you will need a good standard C++ library
implementation for this or you might indeed want to read and
process individual lines. However, 'std::getline()'ing a line and
'std::replace()'ing the tilde characters should do the trick.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting