L
Linuxguy
Hi guys
I need your help.. I am trying to read a line from a file and remove
whitespaces from it but it doesn't work..
thanks
my code;
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
void rm_white(string &str);
int main()
{
char chr;
ifstream infile;
string line;
int k=0;
int i=0;
infile.open ("test");
while(getline(infile,line))
cout<<line; //test
rm_white(line);
cout<<line<<endl;
return 0;
}
void rm_white(string &str)
{
str.erase(0,str12.find_first_not_of(" \t\r\n\f"));
}
I need your help.. I am trying to read a line from a file and remove
whitespaces from it but it doesn't work..
thanks
my code;
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
void rm_white(string &str);
int main()
{
char chr;
ifstream infile;
string line;
int k=0;
int i=0;
infile.open ("test");
while(getline(infile,line))
cout<<line; //test
rm_white(line);
cout<<line<<endl;
return 0;
}
void rm_white(string &str)
{
str.erase(0,str12.find_first_not_of(" \t\r\n\f"));
}