In article <11**********************@h48g2000cwc.googlegroups .com>,
"nik" <am*******@gmail.comwrote:
hello friends,
i want to create a file and copy that file removing white spaces in the
file;
for ex
a file : C:\\abcd.txt
contents of file r: a b c d e.
i want to remove white spaces from the file using skipws .
how can i do this.
Here you go. Paste the below in a file, and insert code where it says
"insert code here" until you can get the program to print "GOOD JOB!".
----------------------------------------------------------------------
#include <iostream>
#include <sstream>
using namespace std;
void copy_no_whitespace( istream& is, ostream& os )
{
// insert code here
}
int main() {
stringstream iss( "a" );
stringstream result;
copy_no_whitespace( iss, result );
assert( result.str() == "a" );
iss.str( "a b" );
result.str( "" );
iss.clear();
result.clear();
copy_no_whitespace( iss, result );
assert( result.str() == "ab" );
iss.str( " a b c " );
result.str( "" );
iss.clear();
result.clear();
copy_no_whitespace( iss, result );
assert( result.str() == "abc" );
cout << "GOOD JOB!\n";
}