Virtual streams – HP Integrity NonStop J-Series User Manual
Page 57

count++;
cout << count << " lines, skipping whitespace.\n";
}
{ int count = 0;
ifstream istr("testfile.dat");
while (line.readLine(istr, FALSE)) // NB: Do not skip
// whitespace
count++;
cout << count << " lines, not skipping whitespace.\n";
}
return 0;
}
Program Input:
line 1
line 5
Program Output:
2 lines, skipping whitespace.
5 lines, not skipping whitespace.
Virtual Streams
String operators to and from Rogue Wave virtual streams are also supported:
Rwvistream& operator>>(RWvistream& vstream, RWCString& cstr);
Rwvostream& operator<<(RWvostream& vstream,
const RWCString& cstr);
By using these operators, you can save and restore a string without knowing its formatting. See
for details on virtual streams.
This manual is related to the following products: