Space file in string

Hi,

I have a problem, caught the last line of a file and do the division of the same variables in, date, time and value

but the file contains excess spaces in all lines and the date is coming with cuts, example 24/4/2014 appears 4/4/2014

How can I remove the space in the string without affecting the division of the line?

1
2
3
4
5
6
7
8
9
10
11
if (file)
    {
        std::string line = getLastLine(file);
        
 	std::istringstream iss(line);
        getline(iss, date, ' ');
        getline(iss, time, '\t');
        getline(iss, t); //variavel para temperatura em string
    }
    else {
        std::cout << "error file\n";
Last edited on
Could someone please help me with this problem?
Wake wrote:
example 24/4/2014 appears 4/4/2014
I don't understand?
because of excess spaces in the string, the display did not show the "2"
Where are the excess spaces?
In the file, the script performs the reading of the entire last line, the line splits into 3 variables
Topic archived. No new replies allowed.